Re: Iterator Syntax
by Glen Starchman other posts by this author
May 8 2002 1:27PM messages near this date
Re: Iterator Syntax
|
Re: Iterator Syntax
On Wednesday 08 May 2002 06:11 am, Pixel wrote:
> I don't know if you have anonymous functions, but you may consider using
> real anonymous functions instead of "blocks".
>
Under the covers my blocks *are* anonymous functions. Currently they are not
truly first class, for example I can't say:
y = {|x| print(x)}
y.call(1) => 1
But that is mostly due to a parser that is inadequate as all of the necessary
plumbing is in the class libraries and VM to handle this.
> Usually programming languages have:
<snip>
> - ruby: blocks are a special beast allowing arguments, and are first class.
> There is a distinction between functions and parameter blocks. Anonymous
> functions are emulated with blocks. You can't have default-value (?) on
> blocks, blocks must use "block.call(args)" instead of "func(args)".
When I first began work on Samson it was an experiment to clean up JavaScript
syntax and to come up with a fast and tight JS VM. Since then things have
morphed greatly, and Ruby is responsible for a good deal of that. (However, I
am still trying to come up with the best unification of a prototype-based
system and an inheritence based system... the code under the covers is pretty
icky at the moment)
<snip>
> > iterate(a,b,c,d).each() { block}
> >
> > that would call the each method of each object in the chain. However, I
> > couldn't think of a good use of that to save my life, so removed it.
>
> well, this is used quite a lot in functional programming languages. If you
> want to allow functional programming style... :)
I think my syntax is convoluted enough at the moment, thanks. Besides, I look
at OCaml and it makes my sick to my stomach... ;-)
Thread:
Glen Starchman
Donal K. Fellows
Glen Starchman
Pixel
Glen Starchman
Buggs
Mathieu Bouchard
Buggs
Mathieu Bouchard
Glen Starchman
|