On Tue, 2007-01-30 at 13:23 -0500, Chris King wrote:
> Hi,
>
> Felix looks like an amazing language and I've recently started trying to
> learn it. Maybe I'm a bad looker, but I can't find a lot of things in the
> reference manual.
The reference manual is incomplete -- writing documentation is much
harder than writing code, and even more dependent on readers for
feedback.
You probably need to look at the tutorial and the regression
tests .. and even then there are features which have no test
cases at all.
In all cases the mailing list is a good resource .. don't hesitate
to ask any questions.
> Things like the syntax and semantics of let...in (is it
> possible to define recursive functions this way?),
Felix 'let/in' is just sugar for match: let ?x = y in z is just
match y with | ?x => z | _ => assert false
Thus it can't be used to define functions, only values.
However values do include closures over functions.
A function in Felix is (notionally) a C++ class,
a closure is an object of that class. The terminology
is confusing but inherited from other functional programming
languages. When you write:
fun f(x:int)=> x + x;
then this 'f' is not a function, but a class. When you write:
var g = f;
then 'g' is variable whose value is a closure of the function f,
that is, an object of the class f. Both these quite distinct
things are often called 'functions' .. neither of them are.
One is a class, the other is an object.
> how to specify guards
> when pattern matching (I found the syntax in a snippet on the mailing
> list),
pattern when expr
The question is: what is the precedence? The answer is "I don't
know", I would have to look at the Ocamlyacc source code to
find out :) Unlike Ocaml, guards are allowed on subpatterns.
> and how to generate standalone executables (is this possible?).
Yes, use
flx --static filename
to get static linkage.
> I'm also
> having trouble compiling flx_doc (using 1.1.1 tarball) so the only
> documentation I have for the standard library is the source code.
Yeah, flx_doc is defunct. The problem is it is hard to sync with
the Ocamlyacc parser: whenever I change the Ocamlyacc parser I should
change the documentation tool too. So 5 minutes work can turn into
many hours of work, and basically I gave up doing it.
Also there is a problem that the tool pretty prints the syntax,
and in particular it cannot calculate the return type of functions
where the author hasn't specified them.
BTW: Felix has changed considerably since the last tarball was
created. You should try to use the svn repository if you can.
The current version supports typeclasses (similar to Haskell)
and the library is being adapted to use them.
> Is there
> a more complete reference than the one referenced from the web site,
Only the source code. We need more developers!
> or in
> lieu of that, a large, well-documented example of most of the constructs in
> Felix beyond those in the tutorial?
I think it would be hard .. and artificial .. to try to use all
the features at once. There are too many! The core language
is reasonably stable, but there are a lot of partially supported
experimental features. For example there is structurally typed
anonymous record construction:
typedef A = struct { x: int; y: long; };
struct { x = 1; y = 2L; }
and there is some interest in being able to use it somehow
to pass arguments to functions by name:
f { x = 1; y = 2L; }
similar to Python, which allows mixing unnamed and named
arguments.. however Felix is strongly typed so it isn't
clear exactly how to do this. The domain where this,
along with default arguments, might be useful is a binding
to a GUI like Win32 GUI or GTK: labelled and optional arguments
were introduced into Ocaml for this application. However they
proved less popular in general code.
So you can say some features are not document for a reason
other than laziness and lack of manpower: it isn't clear
some of the features will be kept.
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language