> At Fri, 4 Nov 2005 12:27:09 +0900, > Trans wrote in [ruby-talk:164082]: >> What's the rationle here? I'd rather have a punctutation mark for 'do' >> (yes, ':' again ;-p)
> Why do you all want colon to overwork so much? ;)
Not all of us -- I'm still in the "conservative about new punctuation" camp :-)
>> At Fri, 4 Nov 2005 12:27:09 +0900, >> Trans wrote in [ruby-talk:164082]: >>> What's the rationle here? I'd rather have a punctutation mark for 'do' >>> (yes, ':' again ;-p)
>> Why do you all want colon to overwork so much? ;)
> Not all of us -- I'm still in the "conservative about new punctuation" > camp :-)
Aren't you the "conservative about most things" camp, David?
>>> At Fri, 4 Nov 2005 12:27:09 +0900, >>> Trans wrote in [ruby-talk:164082]: >>>> What's the rationle here? I'd rather have a punctutation mark for 'do' >>>> (yes, ':' again ;-p)
>>> Why do you all want colon to overwork so much? ;)
>> Not all of us -- I'm still in the "conservative about new punctuation" >> camp :-)
> Aren't you the "conservative about most things" camp, David?
In Ruby development, or in life? :-)
> Do we all not like ";;"?
As a pointless no-op, it's great :-) Is it really being considered as a synonym for 'end'? I don't understand that at all.
[
multipart_mixed_part < 1K ] This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools.
Hi --
On Fri, 4 Nov 2005, Keith Fahlgren wrote: > On Friday 04 November 2005 8:43 am, Brian Schröder wrote: >> Please don't add ;; thats
>> 1) Sheer uglyness >> 2) Parses as a noop operation.
> 3) Going to confuse all the people coming from Lisp...
And, closer to home, all the people coming from Ruby :-)
On Fri, 4 Nov 2005, ts wrote: >>>>>> "K" == Keith Fahlgren <ke...@oreilly.com> writes:
> K> 3) Going to confuse all the people coming from Lisp...
> perhaps the persons coming from Caml will be happy ...
an people who don't like to move their fingers off of the
a s d f j k l ;
;-)
-a -- =========================================================================== ==== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | anything that contradicts experience and logic should be abandoned. | -- h.h. the 14th dalai lama =========================================================================== ====
Trans wrote: > class Foo > def foo; "foo" end > ;; > Foo.new.foo # => "foo"
The funny thing about this example is that the whole point of having ";;" be "end" is that you could write
class Foo def foo; "foo" ;; end
right? Even so, I really don’t see the point, beyond being able to write the following:
if something if something_else ⋮ else ⋮ ;;;;
other_statement
Sort of semi-pythonish or something.
nikolai
-- Nikolai Weibull: now available free of charge at http://bitwi.se/! Born in Chicago, IL USA; currently residing in Gothenburg, Sweden. main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
# {normal args; local variables} d = 2 a = lambda{|;d| d = 1} a.call() d # => 2
I think embedding language specific items in comments is silly since you then have no mechanism to comment them out. Create a directive for these extensions so that they behave as other parts of the language and abide by the standard placement rules. Such as, things that are commented out are not executed and thus ignored.
> # {normal args; local variables} > d = 2 > a = lambda{|;d| d = 1} > a.call() > d # => 2
> I think embedding language specific items in comments is silly since > you then have no mechanism to comment them out. Create a directive for > these extensions so that they behave as other parts of the language and > abide by the standard placement rules. Such as, things that are > commented out are not executed and thus ignored.
The comment was simply that, to indicate what the semi-colon is doing. It has no function. Nonetheless to me its a good indication of a better way:
d = 2 a = lambda{|d| local d = 1} a.call() d # => 2
Trans wrote: > The comment was simply that, to indicate what the semi-colon is doing. > It has no function. Nonetheless to me its a good indication of a better > way:
> d = 2 > a = lambda{|d| local d = 1} > a.call() > d # => 2
> Self commenting.
Sorry, that should be
d = 2 a = lambda{|d| d = 1} a.call() d # => 2
Otherwise:
d = 2 a = lambda{|d| share d = 1} a.call() d # => 1
> On Nov 4, 2005, at 10:53 AM, Nikolai Weibull wrote: > > class Foo > > def foo; "foo" ;; > > end > To save one character?
> class Foo > def foo; "foo" end > end
Hey! I didn’t say that it was great. I just showed what I thought was the rationale behind having ;; in Ruby. Don't blame me for its existance. Anyway, it’s not about saving one character. It’s about having the ; have a better counterpart than end in this particular instance. I didn’t say that it’s worth having just for this, though.
nikolai
-- Nikolai Weibull: now available free of charge at http://bitwi.se/! Born in Chicago, IL USA; currently residing in Gothenburg, Sweden. main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
>> On Nov 4, 2005, at 10:53 AM, Nikolai Weibull wrote:
>>> class Foo >>> def foo; "foo" ;; >>> end
>> To save one character?
>> class Foo >> def foo; "foo" end >> end
> Hey! I didn’t say that it was great. I just showed what I thought > was > the rationale behind having ;; in Ruby. Don't blame me for its > existance.
I didn't mean to blame anyone. I was just trying to understand. :)
> Anyway, it’s not about saving one character. It’s about > having the ; have a better counterpart than end in this particular > instance.
Quoting Domenico De Felice <defelicedomen...@gmail.com>:
> > Using too many special characters clutter the code and worsen > > readability.
> Yes, something like
> { |a, b| > local a > share b > a = 1 > b = 2 > }
> would look less weird. However it has the problem that in bigger > blocks the programmer would need to read back the top of the block > when he 'forgets' which attributes are local and which shared.
I don't know ... honestly, why can't we just make the block parameters always block-local? Having to make closure explicit with share doesn't strike me as very helpful.
There's also a certain "oh, by the way, that variable mentioned earlier is actually closed over from the enclosing scope" factor. Not great for comprehensibility.
Domenico De Felice wrote: > Dale Martenson wrote: > > Sorry for the misunderstanding.
> > I like the "local" and "share" directives. That would make it clear.
> > Using too many special characters clutter the code and worsen > > readability.
> Yes, something like
> { |a, b| > local a > share b > a = 1 > b = 2 > }
> would look less weird. However it has the problem that in bigger blocks > the programmer would need to read back the top of the block when he > 'forgets' which attributes are local and which shared.
They would'nt *have* to be just at the top. You could even do it conditionally, although usage is subtle:
x = false
a = 1 b = 2 lam1 = lambda { |a, b| a = 2 b = 4 if x share b end } lam2 = lambda { b + 1}
> Trans wrote: > [CUT] > > They would'nt *have* to be just at the top. You could even do > it > > conditionally, although usage is subtle:
> [CUT] > > lam1 = lambda { |a, b| > > a = 2 > > b = 4 > > if x > > share b > > end > > } > [CUT]
> Yeah.. share and local directives could be used like any other > command.. this usage is nice. It wouldn't be possible using the > special character (at least not without doing weird things). > However variables scoping, when statically defined, will still be > less intuitive than using special char.
Has anyone considered the semantics of share/local and how they would have to be implemented?
Sure, they look cool, but they'd be a living nightmare in reality...