an people who don't like to move their fingers off of the
a s d f j k l ;
-a
···
On Fri, 4 Nov 2005, ts wrote:
> 3) Going to confuse all the people coming from Lisp...
perhaps the persons coming from Caml will be happy ...
--
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
It sounds too much like Python. Python's syntax is one of the reasons
I don't use Python.
Well, the idea was to give everyone the choice of what they wanted to
use, delimited blocks, or indentation blocks. The only issue with this
is that it adds complexity and one’d have to be able to stand reading
both ways of writing code. I read somewhere that the biggest problem
with C is that it doesn’t restrict the syntax enough:
if (<test>)
<statement a>
<statement b>
It’s an accident waiting to happen. And while having an expressive
syntax is sweet and all, it can cause problems that are hard to spot.
I’m certainly not in the “There’s Only One Way To Write It” camp, but
there is some merit to having a simple, unambiguous syntax.
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);}
> class Foo:
> def foo: "foo"
>
> It sounds more expressive than do .. ;;
..
It sounds too much like Python. Python's syntax is one of the reasons
I don't use Python.
I didn't mean a indentation-block as in Python, but just to use a colon
with one-statement blocks. Multi-statements blocks would look the same.
class Foo
def foo
a = "foo"
a
end
def bar: "bar"
end
The indentation of the statement following the colon would be ignored.
It looks prettier than the double semicolon to me.
With multilines blocks I can't see any reason to change the do .. end
syntax.
···
On 11/4/05, Domenico De Felice <defelicedomenico@gmail.com> wrote:
No! I like to standardize badly indented code of other people using my
editors autoindent function. And I also rely on autoindenting while
writing code. So no significant indentation, please.
brian
···
On 04/11/05, mental@rydia.net <mental@rydia.net> wrote:
Quoting Domenico De Felice <defelicedomenico@gmail.com>:
> class Foo:
> def foo: "foo"
>
> It sounds more expressive than do .. ;;
Serious question: why not permit multi-line bodies this way, by
lining up indention?
Not like Python, but more like Haskell, where using "layout" is
merely optional.
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.
Nikolai Weibull <mailing-lists.ruby-talk@rawuncut.elitemail.org> writes:
Austin Ziegler wrote:
It sounds too much like Python. Python's syntax is one of the reasons
I don't use Python.
Well, the idea was to give everyone the choice of what they wanted to
use, delimited blocks, or indentation blocks. The only issue with this
is that it adds complexity and one’d have to be able to stand reading
both ways of writing code. I read somewhere that the biggest problem
with C is that it doesn’t restrict the syntax enough:
if (<test>)
<statement a>
<statement b>
Using editors that actually can parse what they indent helps a lot
with that. I wouldn't want to code longer pieces without one.
That said, I don't want indentation blocks in Ruby either.
IMO, this is not a good idea. Choose one and stick with it. Also IMO,
Ruby came down on the right side of the debate -- indentation blocks
are excessively fragile.
-austin
···
On 11/4/05, Nikolai Weibull <mailing-lists.ruby-talk@rawuncut.elitemail.org> wrote:
Austin Ziegler wrote:
> It sounds too much like Python. Python's syntax is one of the reasons
> I don't use Python.
Well, the idea was to give everyone the choice of what they wanted to
use, delimited blocks, or indentation blocks.
Ruby permits multiple statements on a single line. Your proposal:
def bar: "bar"
looks unbalanced (because, in fact, it is). It gets worse if you do:
def bar: foo; "bar"
Sorry, but I think that this -- and ;; -- are both bad ideas that
should be dropped.
-austin
···
On 11/5/05, Domenico De Felice <defelicedomenico@gmail.com> wrote:
Austin Ziegler wrote:
> It sounds too much like Python. Python's syntax is one of the reasons
> I don't use Python.
I didn't mean a indentation-block as in Python, but just to use a colon
with one-statement blocks. Multi-statements blocks would look the same.
class Foo
def foo
a = "foo"
a
end
def bar: "bar"
end
The indentation of the statement following the colon would be ignored.
It looks prettier than the double semicolon to me.
With multilines blocks I can't see any reason to change the do .. end
syntax.
Quoting Domenico De Felice <defelicedomenico@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.
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}
On 11/4/05, Nikolai Weibull > <mailing-lists.ruby-talk@rawuncut.elitemail.org> wrote:
> Austin Ziegler wrote:
> > It sounds too much like Python. Python's syntax is one of the
> > reasons I don't use Python.
> Well, the idea was to give everyone the choice of what they wanted
> to use, delimited blocks, or indentation blocks.
IMO, this is not a good idea. Choose one and stick with it. Also IMO,
Ruby came down on the right side of the debate -- indentation blocks
are excessively fragile.
Thanks for repeating what I said in the rest of my response, which you
have elided here.
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);}
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.
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.
Indeed this feature is not essential at all.. but it could come handy
to make some tasks easier.
Anyway if the block will be used 'normally', no directive or something
strange would be used. This should hide anything confusing.