gwtmp01@mac.com writes:
The “core idea” in this case being... what?
negation of a truth value
I guess I missed the tongue-in-cheek nature of your
posting.
Regarding:
assert foo.respond_to? bar
I think that having too much flexibility in a
grammar leads to confusion and different "dialects".
Ruby has a nice balance right now. IMHO. That doesn't
mean that it can't be made better.
If I follow you correctly, you are suggesting that
not only should parenthesis be optional in method
calls
The parentheses are already optional in method calls.
It's just that nested method calls currently need them.
but that the commas should be optional also
Hmm, I don't think I ever suggested that.
and while you are at it you want the not keyword to be
parsed syntactically as an operator/method even though it
doesn't behave as one.
How does the ‘not’ keyword not behave as an operator,
and why shouldn't it?
My gut feeling is that these changes introduce too
much flexibility into the grammar such that it *could*
become difficult for programmer A to understand
programmer B's code. Just my opinion of course.
That is a valid point. Programmer B would have to use his
best judgement, and not write things like the following:
not foo not bar and not baz
(I don't think I have to point out that if B wants to write
code that is difficult for A to understand, there's really
nothing we can do to stop him if we still want Ruby to be
the powerful language it is.)
I also have a feeling from a human-factors point of
view that punctuation is important to improving the
readability of code.
My feeling is that punctuation is important sometimes,
but not necessarily all the time. First of all, this
assert not foo.bar?
can only be parsed one way. You can't say “but I thought
it meant ‘(assert not) foo.bar?’,” because that doesn't even
make sense. Second of all, there are many examples of
methods in Ruby being thought of as language constructs —
one example being ‘assert’.
As such, it can seem strange that the above gives a syntax
error, while this works:
if not foo.bar? ...
Actually, I now realize that this is exactly the reason why
the ‘assert’ example should *not* be allowed.
Consider these two examples:
assert not foo.bar?
assert not foo.bar? and not baz.quux?
I don't think it would be acceptable to have the former work
as intended, while the latter would siletly misbehave.
So I am now convinced that the current syntax is correct.
Had I thought of the above issue earlier, I might not even
have started this thread.
While I think a lisp-like syntax is immensely powerful
from a programatic standpoint I think that it can be
difficult for a human to read and understand quickly.
I would have to agree.
Here is a function from the Version 7 Bourne Shell that was
notorious for its abuse of C macros: [gibberish]
Your point being... that C should not have had macros?
That the Version 7 Bourne Shell should not have abused them?
Or is the analogy that this is all well and good,
My point was that C macros provide a huge amount of syntax
flexibility and that can be abused to the point where it is
hard to read the code.
But would you want to give up that flexibility?
···
On Jul 17, 2005, at 2:34 PM, Daniel Brockman wrote:
--
Daniel Brockman <daniel@brockman.se>
So really, we all have to ask ourselves:
Am I waiting for RMS to do this? --TTN.