[#1649] Re: New Ruby projects — Yukihiro Matsumoto <matz@...>
The following message is a courtesy copy of an article
[#1672] Re: Ruby 1.4 stable manual bug? — Yukihiro Matsumoto <matz@...>
The following message is a courtesy copy of an article
[#1673] Re: Possible problem with ext/socket in 1.5.2 — itojun@...
[#1694] Conventions for our Ruby book — Dave Thomas <Dave@...>
[#1715] Install postgresql support — Ikhlasul Amal <amal@...>
Hi all,
Hi,
[#1786] Is this a bug? — Clemens Hintze <clemens.hintze@...>
(mailed & posted)
[#1814] Objects nested sometimes. — Hugh Sasse Staff Elec Eng <hgs@...>
I am attemptiong to write a package which consists of a workspace
[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>
Hi all,
Hi,
Yukihiro Matsumoto writes:
Hi,
Hi,
[#1834] enum examples? — Hugh Sasse Staff Elec Eng <hgs@...>
Has anyone any examplse of using the Enumerable module? I've had a
[#1844] Minor irritation, can't figure out how to patch it though! — Hugh Sasse Staff Elec Eng <hgs@...>
I was considering how difficult it would be to patch Ruby to accept
[#1889] [ruby-1.5.3] require / SAFE — ts <decoux@...>
[#1896] Ruby Syntax similar to other languages? — "David Douthitt" <DDouthitt@...>
From: Yukihiro Matsumoto <matz@netlab.co.jp>
[#1900] Enumerations and all that. — Hugh Sasse Staff Elec Eng <hgs@...>
Thank you to the people who responded to my questions about Enumerated
Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk> writes:
On 16 Mar 2000, Dave Thomas wrote:
[#1929] Re: Class Variables — "David Douthitt" <DDouthitt@...>
| "David Douthitt" <DDouthitt@cuna.com> writes:
[#1942] no Fixnum#new ? — Quinn Dunkan <quinn@...>
Ok, I can add methods to a built-in class well enough (yes I know about succ,
[#1989] English Ruby/Gtk Tutorial? — schneik@...
Hi,
[#2022] rb_global_entry — ts <decoux@...>
[#2036] Anonymous and Singleton Classes — B_DAVISON <Bob.Davison@...>
I am a Ruby newbie and having some problems getting my mind around certain
[#2069] Ruby/GTK+ question about imlib --> gdk-pixbug — schneik@...
[#2073] Re: eval.rb fails — "Dat Nguyen" <thucdat@...>
The doc is fine, this happens only if you try to execute 'until' block
On Wed, 22 Mar 2000, Dat Nguyen wrote:
[#2084] Scope violated by import via 'require'? — Clemens Hintze <c.hintze@...>
Hi,
[#2104] ARGF or $< — Hugh Sasse Staff Elec Eng <hgs@...>
Has anyone any examples of how to use ARGF or $< as I cannot find much
Hi.
[#2165] Ruby strict mode and stand-alone executables. — "Conrad Schneiker" <schneiker@...>
Some people want Ruby to have a strict compile mode.
[#2203] Re: parse bug in 1.5 — schneik@...
[#2212] Re: Ruby/Glade usage questions. — ts <decoux@...>
>>>>> "m" == mrilu <mrilu@ale.cx> writes:
[#2241] setter() for local variables — ts <decoux@...>
[#2256] Multiple assignment of pattern match results. — schneik@...
[#2267] Re: Ruby and Eiffel — h.fulton@...
[#2309] Question about attribute writers — Dave Thomas <Dave@...>
Clemens Hintze <c.hintze@gmx.net> writes:
[ruby-talk:01723] Re: ruby <=> python
> In message "[ruby-talk:01633] Re: ruby <=> python" > on 00/02/28, Quinn Dunkan <quinn@envy.ugcs.caltech.edu> writes: > > |The other languages approaches seem more intuitive. > |For example, in the haskell prelude: > |type String = [Char] -- strings are lists of characters > > String is actually a Byte String. Since I didn't prepare indent class > for 0..255 integer, bytes are represented by Fixnums. > > Strings are used to represent character strings, and sometimes packed > structure using pack(). Have you ever used Perl's pack()? They are in most other languages too, it's just a question of what comes out when you throw a [] method at them (most other languages give you a byte, but ruby doesn't). > |So why doesn't ruby have a Char class? > > I, as a Japanese, have to deal with several thousands Japanese > characters daily. We have to encode a character in multibyte > sequence. In that circumstance, a character is a sequence of bytes. > We even have several encoding schemes. > > So, it is far harder to define what is a character than you expected, > with I18N in mind. > > Unicode may help us in the future, but > > * Unicode 2.0 is also encoding with mutibyte sequence. > * Unicode 3.0 is not widely used yet, and not a absolute solution. > * I don't have enough editor/tools to treat Unicode. > * We have handreds of gigabytes of data in old encoding, I just > can't abandon separation between byte sequences and character > representation without better solution. > > I hope I can define I18N (or M17N) character system in the future. > Until then, I'd want String serves as byte string. Hmm, well, I would define a character as "whatever you get when you pull one element out of a string." In ruby, this means a character is a Fixnum. In all the (non-unicode, ascii-oriented) languages I know, a character is an 8-bit value. But it's not a number unless you convert it to one, because even if you are pulling apart binary data, bytes aren't numbers, what they are depends on how you parse them. I can't claim to have the understanding of character encoding that you do, but I *agree* with you that the language shouldn't try to be extra clever about what a character is, it should just give you a byte. But ruby *doesn't* give you a byte! It gives you a signed int! > Because I felt using `::' to access class method was a good idea, > e.g. foo = SomeClass::new(). It denotes something (`new' in this > case) belongs to the class. But it doesn't, it works for instance methods too. And `.' works for `class methods' like new. I know I'm not going to get far arguing with the creator of the language :), but what's the rationale for `::' being a good idea? I'm not even sure about the Constant part: the user already knows he's accessing a constant because of capitalization, right? Now he has to remember to use a different operator as well. And if `::' can be used in all situations where `.' would be, it doesn't help much from a `make different kinds of access visually different' point of view. > |Ah, this makes more sense, defined? isn't a method at all. I thought > |everything was a message send in ruby? :) It *could* be "just another > |message send" if you spelled it 'defined? :foo' or 'defined? "foo"'. So > |why not? > > No it isn't. It's a control structure. No everything is a message > send in Ruby, e.g. control structures, variables, blocks are not > objects. `defined? ' is among these things. > > `defined?' shows > > * if a global variable is defined > * if a local variable is defined > * if a instance variable is defined > * if a constant is defined > * if a method is defined > * if a block is supplyed > * if a method of same name in superclass is defined > > all of which is not accomplished by a method. Ok, this makes sense to me. > |I think this just means that || binds too tightly. So the question is "why, > |then, do you need '||'?" > > Maybe just because it is already there. `||' is far older than `or' > in Ruby. Removing things from the language may cause serious > compatibility problem. Ah, hysterical raisons. I'm not a big fan of them, but, practically speaking, there they are :) > `false' is a boolean value, `nil' is a out-of-range value. You know I mean? > I'm considering make 0 false, but not positively. Uh oh, does that mean only -0 is false? My head hurts. > Pros: > > * easier to adopted by C programmers > * easier to adopted by C libraries (e.g. by SWIG) I don't consider these pros: ruby is already different enough from C that similarities might just confuse them more. And don't forget not everyone's a C programmer (but then many other languages say 0 == false, but anyone who knows more than a few will know to not take this for granted). I personally have no problem writing if a.length == 0, and I think that's actually more intuitive to newbies (who are not preprogrammed with a different language), because they see if a.length and think "if a.length what?". But on the other hand, ruby makes a problem here by silently accepting if a.length, and changing that would probably break a lot of code. So maybe 0 == false is a good idea. I dunno. I personally prefer the haskell-style "only accept booleans", which is more clear and mistake-resistant, but would only annoy quick-hack people who don't want to have to type too much. > Cons: ... > * both nil and 0 serve as out-of-range mark, confusing Does it have to? Pardon me if I misunderstand, but everything that returns nil now can still return nil in the future, ne? I think it would be more confusing (in a certain way) because then there would be 3 false values instead of just 2, and it would give the impression that 0.0, '', [], etc. ought to also be false. And then you'd have to supply a false? method like python's __nonzero__ :) > |And, finally, here's a real ruby question: > |What's the general idiom for parallel iteration in ruby? > > There's no such idiom yet. Although I've never met that situation, > but I'd do pop (or unshift) from each arrays. Err, but that modifies the arrays. I almost never want to modify things, and even if it doesn't matter it makes me very nervous. Maybe just my functional background..