On 01/07/2013, at 12:56 AM, srean wrote:
> 
> var a <-- g(b,c)
> 
> makes it easy for the user to express the notion that the call to f(a,b) 
> needs to be forced, regardless of whether I use a later or not. 

Well, you can add this to the grammar yourself easily enough.

It can be implemented by:

        var a = g (b,c);
        C_hack::ignore (a);

That forces 'a' to be considered used, and so the assignment
won't be elided because 'a' isn't used. 

So, IF you write Felix code and you put many of those C_hacks in like that,
I may think about implementing operator <--. 

In fact I have a lot of code like that myself at the moment.
I'm just not convinced its the right solution .. and I have actual code
with that problem.

The reason I'm not convinced is it defeats the original principles
of Felix (which didn't have generators), which as a STRICT separation
of procedural code side effects) into statements, and functional code
(no effects) into expressions.

Generators broke this strict separation. I'm not sure I want to go even further
breaking these principles.

At one time I had this instead:

        proc f ( px: &int, x:int);
        var result <- f x;

which is very similar to what to wanted syntactically however note
carefully f is a procedure and the syntax is just a shorthand for

        var result : &int;
        f ( &result, x);

only the uninitialised variable is hidden and in the syntax it is definitely
initialised. note that this isn't a generator .. its a procedure.

This allows, for example

        proc posix : &int * int = "*$1=posix($2);";

as a definition, you can then write:

        var result <- posix x;

but you can NOT nest "posix x" in an expression since it isn't 
a function. This call to posix cannot be elided, and the variable
result cannot be elided (because its address is taken its considered used).

However I got rid of that syntax for various reasons.

My point: your solution isn't the only one.

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




------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to