On 05/03/2014, at 11:59 AM, srean wrote:

> 
> Write code
> like C++ and you won't have an issue in Felix either.
> 
> Well for the longest time you did not have closures in C++ in the first place.

And still don't, not really.

> So to copy that style would be to not use closures in Felix, which would be 
> rather sad . One does have, what they call functors, but then you get to 
> choose the binding explicitly, so you know what you are getting for the most 
> part.

Right. No lexical scoping so you have to pass all the variables
you want to use explicitly.

Guess what? Felix uses this technique. That's how it works.
It just automates what you would do in C++ with "functors".
It makes all the local variable go into one struct, and passes
the pointer to that struct to your child closure.

in fact, this technology is archaic. The list of scopes, from
root up through to the deepest child, has a name: its
called a "display". Pascal (in the late 70s) used displays.

In fact the x86 has special instructions for managing displays.

Felix procedures are heap allocated structs of variables,
linked together with two pointers: one is the frame of the caller,
which is your usual return address chain. And the other is
the display. Together these two pointers make a spaghetti stack,
i.e. a stack represented on the heap with pointers instead of
a linear array.

in x86 language, the pointer to the current structure is called
the base pointer (BP), only on the x86 it is for stack frames
on the machine stack. Machine stacks are evil, they prevent
exchange of control, which is more fundamental than the
subroutine call, so out the window with machine stacks.

:-=)

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




------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to