in different languages there is need to mark variables as
global/local, const/variable, integer/float and so on. there is
several methods to do this markup:
in variable name. f.e. constants and global vars in ruby
indicated by variable name: Array, $global
by declararation. f.e. type declarators in C or Pascal
by definition, i.e. declararion combinated with some action. as
example - using ‘:=’ to declare var as local PLUS execute ‘=’
first is definitely better if kind of variable can’t be changed
while program grows; third - when there is only one kind of actions,
which can be combined with declaration
to mark vars as local to block we can use any of methods above. but
imho it is better to explicitly declare vars imported from outer
blocks:
a = 1
{
a = 2 # ruby prints warning - outer var used without explicit import
{
import a
a = 3 # OK - changing value of imported variable
{
local a # bad style - reusing outer variable name.
# suitable only for metaprogramming
a = 4
}
{ local a=4 } # same as above, but more suitable for one-liners
}
}
p a #=> 3
proposed style is a less cryptish than other variants and conforms
to principle of least surprise in my vision
a = 1
{
a = 2 # ruby prints warning - outer var used without explicit import
This is a new language ?
Get used to it. This guy is clearly here to stay. Every day it’s a
new language – Ruby du jour. And none of it has much to do with what
we unenlightened people insist on referring to as “Ruby”. Silly us.
Sigh. I’ve kill-filed him, but apparently the attempt to get rid of
even replies to him didn’t work. I’ll check my .procmailrc again.
And yes, I do know that this reply is going to the whole list. At
this point I don’t think mentioning this person as a problem is
terribly shocking. I do wish he’d find another language to troll
in… Perhaps he can try to convince the Java community to remove
explicit type declarations from the language, or try to get golfers to
use a pyramid-shaped ball, or something.
Sigh. I’ve kill-filed him, but apparently the attempt to get rid of
even replies to him didn’t work. I’ll check my .procmailrc again.
I’m using Mozilla to read the Usenet newsgroup (comp.lang.ruby) instead
of being subscribed to the ruby-talk mailing list directly. Does anyone
know if there’s a “killfile” equivalent for Mozilla’s news reader? It’s
not jumping out at me. Barring that, do any of the other good news
clients for Linux have such a feature?
for a lot a people, the best console newsreader. I used it a lot
back when I was following es.comp.linux.* (spanish linux hierarchy,
about 500 msg/day)
If you absolutely want X, I think KNews or pan should do the trick (but
I haven’t used them at all).
BTW, it’s funny that the random fortune cookie below was precisely this
one (slrn is partially implemented in S-Lang, its scripting engine)
···
On Tue, Oct 08, 2002 at 10:30:01PM +0900, Lyle Johnson wrote:
Sigh. I’ve kill-filed him, but apparently the attempt to get rid of
even replies to him didn’t work. I’ll check my .procmailrc again.
I’m using Mozilla to read the Usenet newsgroup (comp.lang.ruby) instead
of being subscribed to the ruby-talk mailing list directly. Does anyone
know if there’s a “killfile” equivalent for Mozilla’s news reader? It’s
not jumping out at me. Barring that, do any of the other good news
clients for Linux have such a feature?
This might sound wildly un-scientific, but I very much prefer matz’s
cautious approach, where features are added carefully and bad style
(such as the example you give) is discouraged by the language, to keeping adding
feature after feature to Ruby until it becomes "interpreted Smalltalk + Perl
CLU + Algol + Lisp + C++ + ??"
I won’t cite Victor Hugo, but its famous quotation applies, IMHO.
···
On Tue, Oct 08, 2002 at 08:04:12PM +0900, Bulat Ziganshin wrote:
Hello ts,
Tuesday, October 08, 2002, 2:49:23 PM, you wrote:
a = 1
{
a = 2 # ruby prints warning - outer var used without explicit import
I don’t quite understand why you both always react so negative to
everything Bulat writes. I don’t like many of his ideas and his
wordings, too, but at least he tries to offer different points of view.
For example to me it is much more natural to explicitely declare
that a block variable should be shared with an outer scope than to
do it the other way round. (I know it breaks the current behaviour,
but so does Matz’s proposal that block parameters should always
be treated as local variables.) And using an explicit keyword is
much more readable than the proposed := syntax, that says
absolutely nothing to me (sorry matz).
So why shouldn’t Bulat be allowed to discuss topics like this?
a = 1
{
a = 2 # ruby prints warning - outer var used without
explicit import
This is a new language ?
Get used to it. This guy is clearly here to stay. Every day it’s a
new language – Ruby du jour. And none of it has much to do with what
we unenlightened people insist on referring to as “Ruby”. Silly us.
Sigh. I’ve kill-filed him, but apparently the attempt to get rid of
even replies to him didn’t work. I’ll check my .procmailrc again.
And yes, I do know that this reply is going to the whole list. At
this point I don’t think mentioning this person as a problem is
terribly shocking. I do wish he’d find another language to troll
in… Perhaps he can try to convince the Java community to remove
explicit type declarations from the language, or try to get golfers to
use a pyramid-shaped ball, or something.
strlist.map{downcase}
like perlish:
map {lc} $strlist
pigeon% more ToDo
[...]
* discourage use of symbol variables (e.g. $/, etc.) in manual
* discourage use of Perlish features by giving warnings.
[...]
pigeon%
I hope that you know that it exist a mailing-list archive at
This might sound wildly un-scientific, but I very much prefer matz’s
cautious approach, where features are added carefully and bad style
(such as the example you give) is discouraged by the language, to
keeping adding feature after feature to Ruby until it becomes
“interpreted Smalltalk + Perl + CLU + Algol + Lisp + C++ + ??”
I won’t cite Victor Hugo, but its famous quotation applies, IMHO.
You mean it was Victor Hugo who wrote:
“I would like to evolve FROM Perl, Java and C++ rather than TO Perl,
Java and C++.”
as “Anonymous” on Ruby Garden?
(Not that P, J, or C++ is the kind of meaningless pastiche we’re
apparently supposed to wish Ruby were being turned into…)
I don’t quite understand why you both always react so negative to
everything Bulat writes. I don’t like many of his ideas and his
wordings, too, but at least he tries to offer different points of view.
Actually I don’t even mind his wording (he probably makes
me feel better about my own fou-pas;-) - if one feels that
he is OT, inappropriate, whatever … one can always ignore
his posting (and replies) - however by doing so one might miss
out on occasionally interesting posts (imho;-) and replies
(e.g. Matz thoughts on overloading versus multiple-dispatch
and coercion) .
This might sound wildly un-scientific, but I very much prefer matz’s
cautious approach, where features are added carefully and bad style
(such as the example you give) is discouraged by the language, to keeping
adding
feature after feature to Ruby until it becomes "interpreted Smalltalk +
Perl
CLU + Algol + Lisp + C++ + ??"
This is very true - but I also think it is reasonable to discuss new
features.
Good design is about considering a lot of different options. Most are
discarded but all contribute to illuminate the problem at hand. Often a more
general solution can be found this way.
I think it is not helpful to discourage suggestions to new Ruby features -
especially because we know they are not going to be implemented lightly.
That said, suggestions could be presented in one or a few mails. They need
not take up 90% of the bandwidth.
a = 1
{
a = 2 # ruby prints warning - outer var used without explicit import
This might sound wildly un-scientific, but I very much prefer matz’s
cautious approach, where features are added carefully and bad style
(such as the example you give) is discouraged by the language,
we can’t do more than printing a warning because another decision will break
compatibility. agree?
to keeping adding
feature after feature to Ruby until it becomes "interpreted Smalltalk + Perl
CLU + Algol + Lisp + C++ + ??"
you are named almost all ruby roots, except eiffel
in this question, we have one unobvious but minimalistic feature. we
can keep the language in current state or mark this feature as
obsolete and give more structured and explicitly expressed way to do
same job. in the second variant my proposition imho is better than
using ‘:=’ to declare variable as local or using ‘:’ as prefix to
local variable names
of course, i prefer to use words in syntax, not cryptic symbols, as
you may be prefer
Tuesday, October 08, 2002, 10:30:53 PM, you wrote:
For example to me it is much more natural to explicitely declare
that a block variable should be shared with an outer scope than to
do it the other way round. (I know it breaks the current behaviour,
but so does Matz’s proposal that block parameters should always
be treated as local variables.)
i considered all the problems and proposed a way which don’t breaks
anything but forces users to use new style as soon as possible
It seems so far that Ruby is usually attributed as taking the best
features of several other languages, but Pascal is not one of them.
To me, coming from the Basic->Fortran->C/C+±>Java->Tcl->Perl->Python
background, the first time I saw Ruby, I said, “it looks like Pascal”,
because of the “end” keywords, and “begin” and “do” (although they are
used differently in Ruby). Now, with the proposed “:=” block
operator, I think then Ruby really looks like Pascal.
Probably some other languages have syntax similar to Pascal, but at
least to me Pascal is the “major” language that is closest to Ruby in
syntax resemblance. (“Major” because at least some time ago the first
language taught in CS is Pascal; remember how Borland’s Turbo Pascal
got its popularity?) So can anyone say about Pascal’s influence on
Ruby? Maybe yes, not at all, or a little bit?
In addition, with “:=” as a new operator, is there any case where it
will be confused with “the symbol of ‘=’”? (Does it look like that in
Ruby, the punctuations begin to have too many different, unrelated
meanings, just as the “static” keyword in C++?)
This might sound wildly un-scientific, but I very much prefer matz’s
cautious approach, where features are added carefully and bad style
(such as the example you give) is discouraged by the language, to keeping adding
feature after feature to Ruby until it becomes "interpreted Smalltalk + Perl