On Tue, 2006-09-05 at 11:07 -0400, Peter Tanski wrote:
> On Sep 4, 2006, at 6:50 AM, skaller wrote:

> > BTW: also note this won't work in Felix at present,
> > because flxPty tried to start work before tanski woke up :)
> 
> I had to read this several times and force myself to believe you are  
> serious. 

Executable code is executed in order of writing.
Variable declarations:

var x = 1;

are also executable. This is not a 'definition' of a synonym
for '1', it is an assignment:

        var x: int;
        x = 1; // assignment


>  This isn't remotely functional-program behavior. 

Felix is a procedural/imperative language with
a functional subsystem.

Note that 'val' is different:

        val x = 1;

is more 'functional'. however at present, vals are
NOT reordered based on dependencies, instead they're
reordered based on what the optimiser thinks will
improve performance without breaking the sequential
semantics.

> > Generally, expressions are eagerly evaluated, statements
> > are executed in order of writing, and finally variant
> > constructors always make a heap copy of their argument:
> > so you'd be copying an uninitialised variable.
> 
> This is not in the documentation 

I know. Felix actually has 'indeterminate' evaluation order.
Sometimes it is eager and sometimes lazy. It depends on the
construct. At least this is the present scenario; in some
cases it isn't clearly defined. When you write a var:

var x = ...

it is sure to be assigned the RHS eagerly. If you write

val x = ...

it is up to the compiler to choose when to evaluate the RHS.
If you want lazy, you can now write:

fun x = ...

and the RHS is guaranteed to be lazily evaluated (it is 
implemented with a closure which is invoked on each use).

And you can have another form:

ref x = ...

which is semi-lazy: a ref is a pointer which is dereferenced
on each use (so the value of x can change if the referent
is mutable and is modified).

> and the declaration of Felix as a  
> "functional" language puts a programmer off guard to expect such  
> behavior.

Who said it was functional? My claim is that it is a traditional
but advanced procedural language, with a functional
subsystem.

If you want 'functional' in the ML sense you can write:

var k = 
  let ?x = 
    let ?a = 1 in
    let ?b = a + 1 in
    a +b
;


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to