On 28/05/2013, at 3:15 AM, john skaller wrote:
> 
>> When I asked about it in #nimrod, they reply was that Nimrod is further
>> developed with better GC.
> 
> Lol. Felix is WAY ahead of Nimrod.

As my knowledge of Nimrod is limited to a couple of brief
readings of the manual, my comments below may be quite uninformed.
Apologies to Nimrod devs if I get anything completely wrong.

Nimrod resembles Python in some ways. I like Python syntax,
so this is a plus. The code is just clearer than the C style which
Felix also uses. But it doesn't cope as well with generators that
have to format stuff or long lines etc.

Nimrod has a lot of front end manipulators: macros, term rewriting,
etc. This stuff looks good in theory but in practice it turns out not
to be very useful. I had a lot of this in Felix at one stage and threw
almost all of it out. 

Instead Felix now has something vastly superior. It has a user defined
GLR+ grammar with action codes which can construct the core terms
the compiler front end accepts, in a very flexible and powerful way
that has a major advantage over anything Nimrod can hope to offer:
the action code is R5RS Scheme, a separately documented standardised
language. I find Scheme hard to write, but there's no doubt it is capable
of doing fairly arbitrary calculations with terms (s-expressions).
so a whole lot of half-assed junk is replaced by two major subsystems:
a high end dynamically extensible parser and a high power term
manipulation language.

Another difference is that Nimrod has a set of types like char
and bool and int etc. Felix has none of these. All scalar types
are lifted from C++ in the library. The provided set is zero. The liftable set
is infinite. The library provides some basic ones (all of C and 
also most of the typedefs, plus C++ complex).

Rather, Felix has type constructors of two kinds: nominal type
constructors for structs and unions (variants), and structural typing
for tuples, arrays and records. And of course functions.

Felix has proper first order parametric polymorphism, Nimrod templates
have the same problems as C++ ones: dependent type names.
Felix has strict parametric polymorphism. It has overloading too
(which is a convenience NOT polymorphism), and it has overloading
tricked up to look like polymorphism in a well structured way:
Haskell style type classes.

Felix does not have iterators like Nimrod. It doesn't need them.
It has generators which are much more basic. A generator is
just a function with side effects eg rand() is a generator.
But Felix does have a yield statement. Any generator doing a yield
is an iterator of some kind. There are no constraints as there are
in Nimrod. There is a downside: Felix iterators, based on generators,
are always closures, and Felix is not so good at optimising them away
at this time.

Felix also has cooperative multitasking with channels for communication,
these are similar I guess to "goroutines" in Go (except Felix has had them
for 15 years or more). I didn't notice Nimrod having anything like this.
This system interfaces cleanly with a builtin asynchronous event handling
system which is used to monitor sockets (and timers).

Felix does NOT have exceptions. There's a non-local goto, and that's
it. Felix can *catch* exceptions generated in C code, and it can *throw*
exceptions, but you cannot catch exceptions in Felix thrown from Felix.
That's because exceptions are C++ things that unwind the machine stack
and Felix does not use the machine stack for procedures.

There is no really satisfactory way to handle errors in Felix other than the
C method: check error codes. Felix enforces this (you cannot forget).
Also the returns can be variants.

Dynamic exception handling is unsafe and evil, and using types for
exceptions is entirely wrong (Ocaml does it right, exception is a single
program wide type with many constructors).

Felix does not have any OO support. In the core system that is.
But there are Java like objects and interfaces which are a lot more 
dynamic and flexible than Java. Like a of stuff in Felix this is just
syntactic sugar: an object is just a record of closures bound
in the scope of the constructor function. The same trick
famously used in CLOS (Objects in Lisp).

Because Felix is designed to work with C/C++, the GC is restricted to
a fairly naive algorithm. Felix uses a very basic mark/sweep. Its hard to see
how this can be any different in any other language that allows for arbitrary
simple binding to C/C++. Felix can tell the difference between Felix heap
pointers and ones allocated by malloc without any need for a type distinction.

Roughly speaking, the aim in Felix is to remove as much as possible
from the language and put it in the library. And that includes syntax.

Nimrod has a loop construction or two. Felix has NO loop constructions.
It just has goto and conditional goto. There ARE loops defined in the
grammar, but remember the grammar is in the library. All of the iterator
stuff is defined in the library (except for the yield statement).

Even literals are defined in the library. If you look carefully you'll see 
there's
a cheat: some constant folding is done in the compiler. That's because I haven't
gotten around to taking it out and putting it in the library where it belongs.

Roughly: because it has to bind to C++ by design. Felix is not a nice clean
pure language. There are compromises to be made to achieve this goal.



--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to