Re:How Ruby Borrowed a Decades Old Idea From Lisp
by masklinn on Tuesday September 18, 2012 @01:07PM
(#4539249)
> Although Smalltalk solves it by introducing a special method call syntax (which is perfectly fine).
Meh. Smalltalk comes from a time when not all languages had to be ALGOL-style, so it just has its own syntax.
> I was mostly thinking about C-style-method-call-syntax when I wrote this (Perl, Python, JS).
That is no issue, if you have first-class blocks. At most you'll have commas between your blocks because they'll be arguments like every other. Here's a python-ish version using chevrons for blocks:
error = (request.form['username'] != app.config['USERNAME']).then(⟨
"Invalid Username"
⟩, else=⟨
None
⟩)
Re:How Ruby Borrowed a Decades Old Idea From Lisp
by prodigal_erik on Tuesday September 18, 2012 @10:52AM
(#4538358)
"Dynamic extent" might be close to what you're talking about. That's what Common Lisp calls the hint that an object may be stack allocated because it's unused after the call.
I stand corrected. Although Smalltalk solves it by introducing a special method call syntax (which is perfectly fine). I was mostly thinking about C-style-method-call-syntax when I wrote this (Perl, Python, JS).
> They do, if you define a variable within the block it'll be local to the block. Ruby 1.9 even allowed shadowing variables from the parent method (which isn't possible in 1.8)
I did mention explicitly that I wasn't talking about variable scope, so yeah, we're both correct :)