# SQLite

**URL:** <https://rubytalk.org/t/sqlite/2439>\
**Category:** ruby-talk\
**Created:** [23 October 2002 01:38 UTC](https://rubytalk.org/t/sqlite/2439 "2002-10-23T01:38:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob\_X](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@Bob\_X](https://rubytalk.org/u/Bob_X)\
**Post date:** [23 October 2002 01:38 UTC](https://rubytalk.org/t/sqlite/2439/1 "2002-10-23T01:38:31Z")

</div>

Anyone working on a Ruby interface for SQLite?

[http://www.sqlite.org/](http://www.sqlite.org/)

---

<div class="post-metadata">

**Author:** ![Joel\_VanderWerf1](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@Joel\_VanderWerf1](https://rubytalk.org/u/Joel_VanderWerf1)\
**Post date:** [23 October 2002 03:33 UTC](https://rubytalk.org/t/sqlite/2439/2 "2002-10-23T03:33:43Z")

</div>

Bob X wrote:

> Anyone working on a Ruby interface for SQLite?
> 
> [http://www.sqlite.org/](http://www.sqlite.org/)

I was curious, so I clicked around on that site a bit and got to…

[http://domingo.dad-it.com/ruby-sqlite.whtm](http://domingo.dad-it.com/ruby-sqlite.whtm)

---

<div class="post-metadata">

**Author:** ![Austin\_Ziegler2](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@Austin\_Ziegler2](https://rubytalk.org/u/Austin_Ziegler2)\
**Post date:** [23 October 2002 03:37 UTC](https://rubytalk.org/t/sqlite/2439/3 "2002-10-23T03:37:36Z")

</div>

- [http://ruby-dbi.sourceforge.net/](http://ruby-dbi.sourceforge.net/) (Ruby/DBI with SQLite DBD)
- [http://domingo.dad-it.com/ruby-sqlite.whtm](http://domingo.dad-it.com/ruby-sqlite.whtm) (Ruby-SQLite)

-austin  
– Austin Ziegler, austin@halostatue.ca on 2002.10.22 at 23.26.10

> **···**
>
> On Wed, 23 Oct 2002 10:38:31 +0900, Bob X wrote:
> 
> > Anyone working on a Ruby interface for SQLite?  
> > [http://www.sqlite.org/](http://www.sqlite.org/)
> 
> > From [http://cvs.hwaci.com:2080/sqlite/wiki?p=SqliteWrappers](http://cvs.hwaci.com:2080/sqlite/wiki?p=SqliteWrappers)

---

<div class="post-metadata">

**Author:** ![Wai-Sun\_Chia1](https://avatars.discourse-cdn.com/v4/letter/w/3da27b/32.png) [@Wai-Sun\_Chia1](https://rubytalk.org/u/Wai-Sun_Chia1)\
**Post date:** [23 October 2002 04:28 UTC](https://rubytalk.org/t/sqlite/2439/4 "2002-10-23T04:28:06Z")

</div>

Here’s a SRPM package which I made from the source files at  
[http://domingo.dad-it.com/ruby-sqlite.whtm](http://domingo.dad-it.com/ruby-sqlite.whtm).

To compile just do a:  
rpm --rebuild ruby-sqlite-0.1-1.src.rpm

Bob X wrote:

[ruby-sqlite-0.1-1.src.rpm](https://rubytalk.org/uploads/short-url/aNRRBLu7UBfnhwXgAxMdpjOynW1.rpm) (4.26 KB)

> **···**
>
> > Anyone working on a Ruby interface for SQLite?
> > 
> > [http://www.sqlite.org/](http://www.sqlite.org/)
> 
> –  
> Wai-Sun “Squidster” Chia  
> Consulting & Integration  
> Linux/Unix/Web Developer Dude

---

<div class="post-metadata">

**Author:** ![520079130762\_0001](https://avatars.discourse-cdn.com/v4/letter/5/858c86/32.png) [@520079130762\_0001](https://rubytalk.org/u/520079130762_0001)\
**Post date:** [23 October 2002 09:09 UTC](https://rubytalk.org/t/sqlite/2439/5 "2002-10-23T09:09:43Z")

</div>

That’s correct. Ruby/DBI supports it, but it has not been tested enough.

Regards,

Michael

> **···**
>
> On Wed, 2002-10-23 at 05:37, Austin Ziegler wrote:
> 
> > On Wed, 23 Oct 2002 10:38:31 +0900, Bob X wrote:
> > 
> > > Anyone working on a Ruby interface for SQLite?  
> > > [http://www.sqlite.org/](http://www.sqlite.org/)
> > 
> > > From [http://cvs.hwaci.com:2080/sqlite/wiki?p=SqliteWrappers](http://cvs.hwaci.com:2080/sqlite/wiki?p=SqliteWrappers)
> > 
> > - [http://ruby-dbi.sourceforge.net/](http://ruby-dbi.sourceforge.net/) (Ruby/DBI with SQLite DBD)

---

<div class="post-metadata">

**Author:** ![Ollivier\_Robert5](https://avatars.discourse-cdn.com/v4/letter/o/54ee81/32.png) [@Ollivier\_Robert5](https://rubytalk.org/u/Ollivier_Robert5)\
**Post date:** [28 October 2002 12:09 UTC](https://rubytalk.org/t/sqlite/2439/6 "2002-10-28T12:09:22Z")

</div>

In article [1035364235.286.92.camel@michael.neumann.all](mailto:1035364235.286.92.camel@michael.neumann.all),

> That’s correct. Ruby/DBI supports it, but it has not been tested enough.

Speaking of Ruby/DBI, is there any plan to support a host specification  
within the connection string w/o needing to use dbd\_proxy and running  
another process ?

Perl/DBI does support it.

e.g.

dbh = DBI.connect (“dbi:Pg:#{spamdb}:host=#{host}”, “roberto”, “”,  
‘AutoCommit’ =\> false)

Thanks,

> **···**
>
> ## Michael Neumann [520079130762-0001@t-online.de](mailto:520079130762-0001@t-online.de) wrote:
> 
> Ollivier ROBERT -=- Eurocontrol EEC/ITM -=- [roberto@eurocontrol.fr](mailto:roberto@eurocontrol.fr)  
> Usenet Canal Historique FreeBSD: The Power to Serve!

---

<div class="post-metadata">

**Author:** ![ts1](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@ts1](https://rubytalk.org/u/ts1)\
**Post date:** [28 October 2002 12:22 UTC](https://rubytalk.org/t/sqlite/2439/7 "2002-10-28T12:22:55Z")

</div>

> dbh = DBI.connect ("dbi:Pg:#{spamdb}:host=#{host}", "roberto", "",  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'AutoCommit' =\> false)

Well, it exist no ?

> **···**
>
> ##  
> &nbsp;&nbsp;# parse a string of the form "database=xxx;key=val;..."  
> &nbsp;&nbsp;# or database:host and return hash of key/value pairs  
> &nbsp;&nbsp;#  
> &nbsp;&nbsp;# improved by John Gorman \<jgorman@webbysoft.com\>  
> &nbsp;&nbsp;def Utils.parse\_params(str)  
> &nbsp;&nbsp;&nbsp;&nbsp;params = str.split(";")  
> &nbsp;&nbsp;&nbsp;&nbsp;hash = {}  
> &nbsp;&nbsp;&nbsp;&nbsp;params.each do |param|  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key, val = param.split("=")  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hash[key] = val if key and val  
> &nbsp;&nbsp;&nbsp;&nbsp;end  
> &nbsp;&nbsp;&nbsp;&nbsp;if hash.empty?  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;database, host = str.split(":")  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hash['database'] = database if database  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hash['host'] = host if host  
> &nbsp;&nbsp;&nbsp;&nbsp;end  
> &nbsp;&nbsp;&nbsp;&nbsp;hash  
> &nbsp;&nbsp;end
> 
> Guy Decoux

---

<div class="post-metadata">

**Author:** ![520079130762\_0001](https://avatars.discourse-cdn.com/v4/letter/5/858c86/32.png) [@520079130762\_0001](https://rubytalk.org/u/520079130762_0001)\
**Post date:** [28 October 2002 12:34 UTC](https://rubytalk.org/t/sqlite/2439/8 "2002-10-28T12:34:32Z")

</div>

This is supported in Ruby/DBI, too.  
But if a host-specifier is allowed or not strongly depends on the used  
database, whether or not the database accepts connections over the  
network.

The driver-URL format is very close to that of Perl’s DBI.

Regards,

Michael

> **···**
>
> On Mon, 2002-10-28 at 13:09, Ollivier Robert wrote:
> 
> > In article [1035364235.286.92.camel@michael.neumann.all](mailto:1035364235.286.92.camel@michael.neumann.all),  
> > Michael Neumann [520079130762-0001@t-online.de](mailto:520079130762-0001@t-online.de) wrote:
> > 
> > > That’s correct. Ruby/DBI supports it, but it has not been tested enough.
> > 
> > Speaking of Ruby/DBI, is there any plan to support a host specification  
> > within the connection string w/o needing to use dbd\_proxy and running  
> > another process ?
> > 
> > Perl/DBI does support it.
> > 
> > e.g.
> > 
> > dbh = DBI.connect (“dbi:Pg:#{spamdb}:host=#{host}”, “roberto”, “”,  
> > ‘AutoCommit’ =\> false)

---

<div class="post-metadata">

**Author:** ![Enric\_Lafont](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@Enric\_Lafont](https://rubytalk.org/u/Enric_Lafont)\
**Post date:** [3 November 2002 01:57 UTC](https://rubytalk.org/t/sqlite/2439/9 "2002-11-03T01:57:29Z")

</div>

Hi all,

I’m a Ruby newbie, and I’m reading now “the ruby way” and reading this  
book some comments make me think.  
I’ve a strong Smalltalk heritage, so I’m somewhat biassed.

I would like to know…

Why does common operators like “=” , “and”, " …" , “or” etc … can  
not be overloaded or redefined ?, maybe the complexity of the Ruby  
parser comes from the fact that everything is ALMOST an object or a  
method. Why is not “=” a method ? Same question for “and” and the rest  
of operators that can not be redefined, Does the actual implementation  
make life easier for the designer ? I say so because for me is more  
natural when everything is an object (without exceptions, here Ruby  
follows the rule pretty well) and a method is a method ever, not  
sometimes. Some methods are keywords, and some other are not v.g. loop  
vs. while. The every call is a method could simplify greatly the sintax  
parser (look at the Smalltalk parser).

Why primitives are hidden ? In smalltalk you can call a primitive every  
time you want with a \<primitive: aNumber\> , this way the implementation  
of native methods, and in some way native Classes like String are not  
hidden from the programmer, freeing the programmer to change the  
behaviour if needed. Yes you can have the “required” clause and use  
binary libraries, but would not be much more “natural” to have a  
"require string" when you want to invoque string libraries instead of  
having them loaded all the time ?. I want to say here that the  
"primitive" keyword frees the language from it’s implementation. This  
favours the everything is a module aproach.

Sintax Sugar (SS), other thing difficult to understand for me, the  
question here is why ? Everything has exceptions very few things are  
orthogonal with the principe that must drive it, you can wite a.+(3) or  
a + 3 or a.+ 3 or a hundred other ways to write the same thing, yes,  
this gives you freedom, but a bad deserved (not needed) one. I use one  
form, but when I read programs from other persons the code seems strange  
and somewhat dificult to read. Sometimes SS is right, v.g. x +=1, but  
the every call is a method aproach could give you the same results  
without trouble, in this case += could be a method. As could be “++” or  
others.

Undeclared variables, I don’t know other people but I do fast typing and  
writing “aVariable” and “aVariabel” is a mistake that I can do very  
easily. Yes you can say, type more slowly, but this is not a solution, I  
would like to have a way to force the compiler to generate a warning  
when I use a non pre-declared (or pre asigned) variable.

Why are Strings arrays of integers ? aString[0] is an integer, yes, it’s  
the way it is, but I would like to have String as an array of chars, and  
char if you want as a descendant of Integer (nice election because a  
Unicode String is and array of double chars i.e. integer), I don’t know  
you, but for me aString[i].chr ==‘x’ is somewhat unnatural, because it  
breaks the semantic of a String, so it’s not intuitive for me.

Why is Ruby an interpreter ? Yes the less traditional bytecode aproach,  
can be harder (or not), but enables external optimizations more easily  
(JIT and similars) because the language are separated from the  
implementation, enables reduced footprint and gives faster execution  
times, yes, look at how Self executes programs, it’s amazingly fast (and  
incredibly complex also), but a separated implementation could help  
develop better Ruby-engines.

Don’t get me wrong, I understand that Ruby is a young language that  
needs some maturing, and I love how easy is to learn, it’s dinamicity  
and the fact that is a kind of mix between my loved Smalltalk, Self and  
other languages. In fact I’m writing this because I want to understand  
Ruby better and becasue I want to make some suggestions for future  
releases, maybe Mr. Matsumoto would like to consider some of them

There are more things that I see as strange in Ruby, but this is enought  
for now …

Please if I’ve make any inaccuracy , don’t be too rude with me, I’m  
still learning, and I’ve a loooong way before understand everyting. I’m  
just looking for answers.

Enric

---

<div class="post-metadata">

**Author:** ![Enric\_Lafont](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@Enric\_Lafont](https://rubytalk.org/u/Enric_Lafont)\
**Post date:** [3 November 2002 13:41 UTC](https://rubytalk.org/t/sqlite/2439/10 "2002-11-03T13:41:40Z")

</div>

Hi all,

I’m a Ruby newbie, and I’m reading now “the ruby way” and reading this  
book some comments made me think a lot about Ruby.  
I’ve a strong Smalltalk heritage, so I’m somewhat biassed.

I would like to know…

Why does common operators like “=” , “and”, " …" , “or” etc … can  
not be overloaded or redefined ?, maybe the complexity of the Ruby  
parser comes from the fact that everything is ALMOST an object or a  
method. Why is not “=” a method ? Same question for “and” and the rest  
of operators that can not be redefined, Does the actual implementation  
make life easier for the designer ? I say so because for me is more  
natural when everything is an object (without exceptions, here Ruby  
follows the rule pretty well) and a method is a method ever, not  
sometimes. Some methods are keywords, and some other are not v.g. loop  
vs. while. The every call is a method could simplify greatly the sintax  
parser.

Why primitives are hidden ? In smalltalk you can call a primitive every  
time you want with a \<primitive: aNumber\> , this way the implementation  
of native methods, and in some way native Classes like String are not  
hidden from the programmer, freeing the programmer to change the  
behaviour if needed. Yes you can have the “required” clause and use  
binary libraries, but would not be much more “natural” to have a  
"require string" when you want to invoque string libraries instead of  
having them loaded all the time ?. I want to say here that the  
"primitive" keyword frees the language from it’s implementation. This  
favours a everything is a module aproach.

Sintax Sugar (SS), other thing difficult to understand for me, the  
question here is why ? Everything has exceptions very few things are  
orthogonal with the principe that must drive it, you can wite a.+(3) or  
a + 3 or a.+ 3 or a hundred other ways to write the same thing, yes,  
this gives you freedom, but a bad deserved (not needed) one. I use one  
form, but when I read programs from other persons the code seems strange  
and somewhat dificult to read. Sometimes SS is right, v.g. x +=1, but  
the every call is a method aproach could give you the same results  
without trouble, in this case += could be a method. As could be “++” or  
others.

Undeclared variables, I don’t know other people but I do fast typing and  
writing “aVariable” and “aVariabel” is a mistake that I can do very  
easily. Yes you can say, type more slowly, but this is not a solution, I  
would like to have a way to force the compiler to generate a warning  
when I use a non pre-declared (or pre asigned) variable.

Why are Strings arrays of integers ? aString[0] is an integer, yes, it’s  
the way it is, but I would like to have String as an array of chars, and  
char if you want as a descendant of Integer (nice election because a  
Unicode String is and array of double chars i.e. integer), I don’t know  
you, but for me aString[i].chr ==‘x’ is somewhat unnatural, because it  
breaks the semantic of a String, so it’s not intuitive for me.

Why is Ruby an interpreter ? Yes the less traditional bytecode aproach,  
can be harder (or not), but enables external optimizations more easily  
(JIT and similars) because the language are separated from the  
implementation, enables reduced footprint and gives faster execution  
times, yes, look at how Self executes programs, it’s amazingly fast (and  
incredibly complex also), but a separated implementation could help  
develop better Ruby-engines.

Don’t get me wrong, I understand that Ruby is a young language that  
needs some maturing, and I love how easy is to learn, it’s dinamicity ,  
it’s scriptability and the fact that is a kind of mix between my loved  
Smalltalk, Self and other languages. In fact I’m writing this because I  
want to understand Ruby better and becasue I want to make some  
suggestions for future releases, maybe Mr. Matsumoto would like to  
consider some of them.

There are more things that I see equally strange in Ruby, but this is  
enought for now …

Please if I’ve make any inaccuracy , don’t be too rude with me, I’m  
still learning, and I’ve a loooong way before I understand everyting.  
I’m just looking for answers and explanations.

Enric

---

<div class="post-metadata">

**Author:** ![Enric\_Lafont](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@Enric\_Lafont](https://rubytalk.org/u/Enric_Lafont)\
**Post date:** [3 November 2002 20:17 UTC](https://rubytalk.org/t/sqlite/2439/11 "2002-11-03T20:17:33Z")

</div>

Hi all,

I’m a Ruby newbie, and I’m reading now “the ruby way” and reading this  
book some comments made me think a lot about Ruby.  
I’ve a strong Smalltalk heritage, so I’m somewhat biassed.

I would like to know…

Why does common operators like “=” , “and”, " …" , “or” etc … can  
not be overloaded or redefined ?, maybe the complexity of the Ruby  
parser comes from the fact that everything is ALMOST an object or a  
method. Why is not “=” a method ? Same question for “and” and the rest  
of operators that can not be redefined, Does the actual implementation  
make life easier for the designer ? I say so because for me is more  
natural when everything is an object (without exceptions, here Ruby  
follows the rule pretty well) and a method is a method ever, not  
sometimes. Some methods are keywords, and some other are not v.g. loop  
vs. while. The every call is a method could simplify greatly the sintax  
parser.

Why primitives are hidden ? In smalltalk you can call a primitive every  
time you want with a \<primitive: aNumber\> , this way the implementation  
of native methods, and in some way native Classes like String are not  
hidden from the programmer, freeing the programmer to change the  
behaviour if needed. Yes you can have the “required” clause and use  
binary libraries, but would not be much more “natural” to have a  
"require string" when you want to invoque string libraries instead of  
having them loaded all the time ?. I want to say here that the  
"primitive" keyword frees the language from it’s implementation. This  
favours a everything is a module aproach.

Sintax Sugar (SS), other thing difficult to understand for me, the  
question here is why ? Everything has exceptions very few things are  
orthogonal with the principe that must drive it, you can wite a.+(3) or  
a + 3 or a.+ 3 or a hundred other ways to write the same thing, yes,  
this gives you freedom, but a bad deserved (not needed) one. I use one  
form, but when I read programs from other persons the code seems strange  
and somewhat dificult to read. Sometimes SS is right, v.g. x +=1, but  
the every call is a method aproach could give you the same results  
without trouble, in this case += could be a method. As could be “++” or  
others.

Undeclared variables, I don’t know other people but I do fast typing and  
writing “aVariable” and “aVariabel” is a mistake that I can do very  
easily. Yes you can say, type more slowly, but this is not a solution, I  
would like to have a way to force the compiler to generate a warning  
when I use a non pre-declared (or previously asigned) variable.

Why are Strings arrays of integers ? aString[0] is an integer, yes, it’s  
the way it is, but I would like to have String as an array of chars, and  
char if you want as a descendant of Integer (nice election because a  
Unicode String is and array of 16bit chars, a.k.a. short integer). I  
don’t know for you, but for me aString[i].chr ==‘x’ is somewhat  
unnatural, because it breaks the semantic of a String, so it’s not  
intuitive for me.

Why is Ruby an interpreter ? Yes the less traditional bytecode aproach,  
can be harder (or not), but enables external optimizations more easily  
(JIT and similars) because the language are separated from the  
implementation, enables reduced footprint and gives faster execution  
times, yes, look at how Self executes programs, it’s amazingly fast (and  
complex also), but a separated implementation could help develop better  
Ruby-engines.

Don’t get me wrong, I understand that Ruby is a young language that  
needs some maturing, and I love how easy is to learn, it’s dinamicity ,  
it’s scriptability and the fact that is a kind of mix between my loved  
Smalltalk, Self and other languages. In fact I’m writing this because I  
want to understand Ruby better and becasue I want to make some  
suggestions for future releases, maybe Mr. Matsumoto would like to  
consider some of them.

There are more things that I see equally strange in Ruby, but this is  
enought for now …

Please if I’ve make any inaccuracy , don’t be too rude with me, I’m  
still learning, and I’ve a loooong way before I understand everyting.  
I’m just looking for answers and explanations.

Enric

---

<div class="post-metadata">

**Author:** ![Ollivier\_Robert5](https://avatars.discourse-cdn.com/v4/letter/o/54ee81/32.png) [@Ollivier\_Robert5](https://rubytalk.org/u/Ollivier_Robert5)\
**Post date:** [29 October 2002 21:15 UTC](https://rubytalk.org/t/sqlite/2439/12 "2002-10-29T21:15:35Z")

</div>

In article [1035808517.286.9.camel@michael.neumann.all](mailto:1035808517.286.9.camel@michael.neumann.all),

> **···**
>
> Michael Neumann [520079130762-0001@t-online.de](mailto:520079130762-0001@t-online.de) wrote:
> 
> > This is supported in Ruby/DBI, too.  
> > But if a host-specifier is allowed or not strongly depends on the used  
> > database, whether or not the database accepts connections over the  
> > network.
> 
> Thanks, last time I checked, it wasn’t here (or I missed it).
> 
> ## Duh.
> 
> Ollivier ROBERT -=- Eurocontrol EEC/ITM -=- [roberto@eurocontrol.fr](mailto:roberto@eurocontrol.fr)  
> Usenet Canal Historique FreeBSD: The Power to Serve!

---

<div class="post-metadata">

**Author:** ![HAL\_9000](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@HAL\_9000](https://rubytalk.org/u/HAL_9000)\
**Post date:** [3 November 2002 02:52 UTC](https://rubytalk.org/t/sqlite/2439/13 "2002-11-03T02:52:44Z")

</div>

> Hi all,

Hi Enric…

The list is quiet since many of the main posters  
are at the Ruby Conference in Seattle. 🙂 I’ll try  
to answer what I can here.

I also suggest that you read the Ruby FAQ (which is  
on [rubycentral.com](http://rubycentral.com) I think).

> I’m a Ruby newbie, and I’m reading now “the ruby way” and reading this  
> book some comments make me think.  
> I’ve a strong Smalltalk heritage, so I’m somewhat biassed.

Thank you for reading it. I hope still more people will.

I don’t know Smalltalk, though I’ve heard great things about it,  
so I can’t comment on that specifically.

> I would like to know…
> 
> Why does common operators like “=” , “and”, " …" , “or” etc … can  
> not be overloaded or redefined ?, maybe the complexity of the Ruby  
> parser comes from the fact that everything is ALMOST an object or a  
> method. Why is not “=” a method ?

Here is one way to look at it. A variable is essentially a reference  
to an object. A method is invoked on an object. An object never  
changes class (perhaps it can in Smalltalk?).

If I say: x = “hello”  
then what is the receiver for the method call “=”? You can’t say it’s  
x, because x is not an object.

On the other hand, the number 5 is an object. If I say: 5 = “hello”  
does that mean that every reference to the number 4 is now a reference  
to the string “hello”?

> Same question for “and” and the rest  
> of operators that can not be redefined, Does the actual implementation  
> make life easier for the designer ? I say so because for me is more  
> natural when everything is an object (without exceptions, here Ruby  
> follows the rule pretty well) and a method is a method ever, not  
> sometimes. Some methods are keywords, and some other are not v.g. loop  
> vs. while. The every call is a method could simplify greatly the sintax  
> parser (look at the Smalltalk parser).

I can’t speak for Matz, but I have NEVER seen him make a design decision  
because it made life easier for the designer rather than the programmer.

I have seen him make compromises for clarity or efficiency, however. I  
suspect that these fall into these categories somewhere.

As for simplifying the parser: I think you will agree it is better to  
have a readable, usable language than a simple parser.

Sometimes languages that are very powerful have difficult syntax (LISP,  
Smalltalk, etc.). LISP is arguably the most powerful language in the  
world, but people find it difficult to learn and use. Ruby is full of  
compromises in its design.

> Why primitives are hidden ? In smalltalk you can call a primitive every  
> time you want with a \<primitive: aNumber\> , this way the implementation  
> of native methods, and in some way native Classes like String are not  
> hidden from the programmer, freeing the programmer to change the  
> behaviour if needed. Yes you can have the “required” clause and use  
> binary libraries, but would not be much more “natural” to have a  
> “require string” when you want to invoque string libraries instead of  
> having them loaded all the time ?. I want to say here that the  
> “primitive” keyword frees the language from it’s implementation. This  
> favours the everything is a module aproach.

I’m not sure about everything you’re asking here. But you can in fact  
change the behavior of the standard classes, since the classes are “open.”  
There are many examples of this in TRW.

> Sintax Sugar (SS), other thing difficult to understand for me, the  
> question here is why ? Everything has exceptions very few things are  
> orthogonal with the principe that must drive it, you can wite a.+(3) or  
> a + 3 or a.+ 3 or a hundred other ways to write the same thing, yes,  
> this gives you freedom, but a bad deserved (not needed) one. I use one  
> form, but when I read programs from other persons the code seems strange  
> and somewhat dificult to read. Sometimes SS is right, v.g. x +=1, but  
> the every call is a method aproach could give you the same results  
> without trouble, in this case += could be a method. As could be “++” or  
> others.

In Ruby, a += b means a = a + b ALWAYS, without fail. This means that you  
get += “for free” when you define +, and you are spared having to write  
both. If you want += to have some other meaning, I would have to ask “Why?”  
It seems logical to me to tie the meaning of += to + (unlike C++).

As for ++ and --, these are impossible in Ruby for much the same reason  
I mentioned before. They are operations on variables, whereas Ruby methods  
and operators work on objects. If I say: x++ I am trying to increment  
the OBJECT that x refers to. Does this mean that every variable with the  
same value should be changed also? For that matter, what should 5++ mean?

> Undeclared variables, I don’t know other people but I do fast typing and  
> writing “aVariable” and “aVariabel” is a mistake that I can do very  
> easily. Yes you can say, type more slowly, but this is not a solution, I  
> would like to have a way to force the compiler to generate a warning  
> when I use a non pre-declared (or pre asigned) variable.

If you use it on the right hand side, it will be an error.

It was difficult for me to get used to a language without variable  
declarations. But it seems to be a thing which Matz always insists on.  
And I got used to it, and now I like it.

> Why are Strings arrays of integers ? aString[0] is an integer, yes, it’s  
> the way it is, but I would like to have String as an array of chars, and  
> char if you want as a descendant of Integer (nice election because a  
> Unicode String is and array of double chars i.e. integer), I don’t know  
> you, but for me aString[i].chr ==‘x’ is somewhat unnatural, because it  
> breaks the semantic of a String, so it’s not intuitive for me.

This was never intuitive for me either.

> Why is Ruby an interpreter ? Yes the less traditional bytecode aproach,  
> can be harder (or not), but enables external optimizations more easily  
> (JIT and similars) because the language are separated from the  
> implementation, enables reduced footprint and gives faster execution  
> times, yes, look at how Self executes programs, it’s amazingly fast (and  
> incredibly complex also), but a separated implementation could help  
> develop better Ruby-engines.

This is planned. Matz wants to add bytecodes to 2.0 I think (which is  
still vaporware). In addition, Parrot is being designed not just with  
Perl in mind but Python and Ruby as well. So it should be possible to  
write a Parrotized version as well (though it has not been done yet).

There is also JRuby, which strives for interoperation with Java. I have  
not played with it yet.

> Don’t get me wrong, I understand that Ruby is a young language that  
> needs some maturing, and I love how easy is to learn, it’s dinamicity  
> and the fact that is a kind of mix between my loved Smalltalk, Self and  
> other languages. In fact I’m writing this because I want to understand  
> Ruby better and becasue I want to make some suggestions for future  
> releases, maybe Mr. Matsumoto would like to consider some of them

My advice is to wait 90 days before suggesting language changes. 🙂  
Every newbie makes these suggestions (as I guess I did too). But most  
of them have been thought of before (as a search of the list archives  
will show). Some are under consideration, some are planned for the  
future, and some have been rejected by Matz.

> There are more things that I see as strange in Ruby, but this is enought  
> for now …
> 
> Please if I’ve make any inaccuracy , don’t be too rude with me, I’m  
> still learning, and I’ve a loooong way before understand everyting. I’m  
> just looking for answers.

I hope no one here is rude to you. If someone is, we will  
come to your defense… 🙂

Hal Fulton

> **···**
>
> ----- Original Message -----  
> From: “Enric Lafont” [enric@1smart.com](mailto:enric@1smart.com)  
> To: “ruby-talk ML” [ruby-talk@ruby-lang.org](mailto:ruby-talk@ruby-lang.org)  
> Sent: Saturday, November 02, 2002 7:57 PM  
> Subject: Thoughts on Ruby

---

<div class="post-metadata">

**Author:** ![Albert2](https://avatars.discourse-cdn.com/v4/letter/a/3be4f8/32.png) [@Albert2](https://rubytalk.org/u/Albert2)\
**Post date:** [3 November 2002 04:59 UTC](https://rubytalk.org/t/sqlite/2439/14 "2002-11-03T04:59:06Z")

</div>

> Hi all,
> 
> I’m a Ruby newbie, and I’m reading now “the ruby way” and reading this  
> book some comments make me think.  
> I’ve a strong Smalltalk heritage, so I’m somewhat biassed.

Hi, Enric.  
I also have a Smalltalk background. When I first encountered Ruby I asked  
myself many of the same questions you have.

> I would like to know…
> 
> Why does common operators like “=” , “and”, " …" , “or” etc … can  
> not be overloaded or redefined ?, maybe the complexity of the Ruby  
> parser comes from the fact that everything is ALMOST an object or a  
> method. Why is not “=” a method ? Same question for “and” and the rest  
> of operators that can not be redefined, Does the actual implementation  
> make life easier for the designer ? I say so because for me is more  
> natural when everything is an object (without exceptions, here Ruby  
> follows the rule pretty well) and a method is a method ever, not  
> sometimes. Some methods are keywords, and some other are not v.g. loop  
> vs. while. The every call is a method could simplify greatly the sintax  
> parser (look at the Smalltalk parser).

Smalltalk is pure OOP. Ruby is not. In Smalltalk the “operators” are simply  
messages to an object. In Ruby “operators” are neither objects nor messages,  
but are rather handled as in more conventional languages. I don’t know why  
Matz only went part way. This part-way-ness is also visible in other  
aspects of the language such as “if”, “while”, etc. In Ruby these things  
also are neither object nor message. Whereas in Smalltalk, such constructs  
are messages to a Boolean object.

> Why primitives are hidden ? In smalltalk you can call a primitive every  
> time you want with a \<primitive: aNumber\> , this way the implementation  
> of native methods, and in some way native Classes like String are not  
> hidden from the programmer, freeing the programmer to change the  
> behaviour if needed. Yes you can have the “required” clause and use  
> binary libraries, but would not be much more “natural” to have a  
> “require string” when you want to invoque string libraries instead of  
> having them loaded all the time ?. I want to say here that the  
> “primitive” keyword frees the language from it’s implementation. This  
> favours the everything is a module aproach.

Again, what can I say? Ruby is not Smalltalk. Large amounts of functionality  
that in Smalltalk were written in Smalltalk, were in Ruby written in C.

> Sintax Sugar (SS), other thing difficult to understand for me, the  
> question here is why ? Everything has exceptions very few things are  
> orthogonal with the principe that must drive it, you can wite a.+(3) or  
> a + 3 or a.+ 3 or a hundred other ways to write the same thing, yes,  
> this gives you freedom, but a bad deserved (not needed) one. I use one  
> form, but when I read programs from other persons the code seems strange  
> and somewhat dificult to read. Sometimes SS is right, v.g. x +=1, but  
> the every call is a method aproach could give you the same results  
> without trouble, in this case += could be a method. As could be “++” or  
> others.

I agree with you for the same reasons you give. I am a hater of syntax sugar.

> Undeclared variables, I don’t know other people but I do fast typing and  
> writing “aVariable” and “aVariabel” is a mistake that I can do very  
> easily. Yes you can say, type more slowly, but this is not a solution, I  
> would like to have a way to force the compiler to generate a warning  
> when I use a non pre-declared (or pre asigned) variable.

This is a difference that I have grown to like. Running back to the top of a  
method every I need a variable name was tedious.

> Why are Strings arrays of integers ? aString[0] is an integer, yes, it’s  
> the way it is, but I would like to have String as an array of chars, and  
> char if you want as a descendant of Integer (nice election because a  
> Unicode String is and array of double chars i.e. integer), I don’t know  
> you, but for me aString[i].chr ==‘x’ is somewhat unnatural, because it  
> breaks the semantic of a String, so it’s not intuitive for me.

It is not intuitive to many people. There have been long discussions on the  
pros and cons.

> Why is Ruby an interpreter ? Yes the less traditional bytecode aproach,  
> can be harder (or not), but enables external optimizations more easily  
> (JIT and similars) because the language are separated from the  
> implementation, enables reduced footprint and gives faster execution  
> times, yes, look at how Self executes programs, it’s amazingly fast (and  
> incredibly complex also), but a separated implementation could help  
> develop better Ruby-engines.

All the things you mention are under consideration or under development.

> Don’t get me wrong, I understand that Ruby is a young language that  
> needs some maturing, and I love how easy is to learn, it’s dinamicity  
> and the fact that is a kind of mix between my loved Smalltalk, Self and  
> other languages. In fact I’m writing this because I want to understand  
> Ruby better and becasue I want to make some suggestions for future  
> releases, maybe Mr. Matsumoto would like to consider some of them

Most of the features I loved about Smalltalk are in Ruby. But what I do not  
miss from Smalltalk is fact that it is image based. Ruby is not, and I think  
that is a good thing.

> There are more things that I see as strange in Ruby, but this is enought  
> for now …
> 
> Please if I’ve make any inaccuracy , don’t be too rude with me, I’m  
> still learning, and I’ve a loooong way before understand everyting. I’m  
> just looking for answers.

I think you will find that this is a very friendly list. Welcome.

> **···**
>
> On Saturday 02 November 2002 7:57 pm, Enric Lafont wrote:
> 
> > Enric
> 
> –  
> “I invented the term Object-Oriented, and I can  
> tell you I did not have C++ in mind.”  
> -Alan Kay

---

<div class="post-metadata">

**Author:** ![Austin\_Ziegler2](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@Austin\_Ziegler2](https://rubytalk.org/u/Austin_Ziegler2)\
**Post date:** [3 November 2002 05:56 UTC](https://rubytalk.org/t/sqlite/2439/15 "2002-11-03T05:56:27Z")

</div>

> Why does common operators like “=” , “and”, " …" , “or” etc …  
> can not be overloaded or redefined ?, maybe the complexity of the  
> Ruby parser comes from the fact that everything is ALMOST an  
> object or a method.

I don’t actually see this (that everything is “almost” an object).  
Personally, I think that matz has made the right choice in making  
boolean operations (and, &&, or, ||) invariant in the language. You  
can, by the way, redefine the bit operators (& and |). There’s  
nothing worse than a language which doesn’t do what you expect it to  
do with conditionals, and it does so on the whim of another  
programmer.

> Why is not “=” a method?

Because it’s not something done to objects, but to reference  
variables that we use to manipulate objects. I’m really curious as  
to why one would want to redefine assignment in the first place. I  
mean, seriously. It’s not like this is C++ where you have to  
reinvent everything every time you work with the bloody language.

> Same question for “and” and the rest of operators that can not be  
> redefined, Does the actual implementation make life easier for the  
> designer ? I say so because for me is more natural when everything  
> is an object (without exceptions, here Ruby follows the rule  
> pretty well) and a method is a method ever, not sometimes.

This is just MNSHO, but again I don’t see why one would want to  
allow such basic constructs to be redefined. IMO, you can redefine  
everything except boolean tests and still have a useful – if obtuse  
– language; if you try to redefine those, you’re not going to be  
able to have any determinacy with the programs that are written.

> Some methods are keywords, and some other are not v.g. loop vs.  
> while. The every call is a method could simplify greatly the  
> sintax parser (look at the Smalltalk parser).

while is a boolean test as much as a loop construct.

> Why primitives are hidden ? In smalltalk you can call a primitive  
> every time you want with a \<primitive: aNumber\> , this way the  
> implementation of native methods, and in some way native Classes  
> like String are not hidden from the programmer, freeing the  
> programmer to change the behaviour if needed.

Why is it necessary to access the primitives? IMO, Java’s biggest  
problem is that it makes the primitives available. In Ruby, by the  
way, I can still change the behaviour of String – this is where  
Ruby differs from every other language that I’ve ever used: it’s  
dynamic. If I need a new function on String, I can add it whenever I  
need. I’m looking at extending the functionality of a library that  
I’ve ported so that it can optionally extend String and Array to  
include this library as methods on String and Array instead of as  
something else to operate on a String or an Array.

> Yes you can have the “required” clause and use binary libraries,  
> but would not be much more “natural” to have a “require string”  
> when you want to invoque string libraries instead of having them  
> loaded all the time ?. I want to say here that the “primitive”  
> keyword frees the language from it’s implementation. This favours  
> the everything is a module aproach.

I disagree – allowing access to the primitives ties the developer  
very tightly to the local implemententation of the language. I don’t  
particularly care whether or not my integers are 32-bit or 64-bit or  
even larger – I just expect them to do what they should do (and  
that means possibly upclassing to a BigNum class if I exceed the  
word size). I think that the only thing that I’d like to see in this  
regard is for Ruby to take a page from Ada and allow me to define  
ranges as types (that is, I want to be able to automatically define  
a class UInt64 \< Integer [(-2**64) … (2**64 - 1)] and have it do  
the Right Thing).

It would NOT be much more natural to require every bloody module I  
need every time I need it. A language – especially a language like  
Ruby, where Strings are fundamental to everything – isn’t useful  
without certain defaults. Would it not make equal sense to “require  
integer” when I need to use integers, or are you suggesting that  
those are fundamentals and are always included? Strings are part of  
what makes Ruby useful immediately (the same applies to Files)  
because it’s a scrpiting language.

> Sintax Sugar (SS), other thing difficult to understand for me, the  
> question here is why ? Everything has exceptions very few things  
> are orthogonal with the principe that must drive it, you can wite  
> a.+(3) or a + 3 or a.+ 3 or a hundred other ways to write the same  
> thing, yes, this gives you freedom, but a bad deserved (not  
> needed) one. I use one form, but when I read programs from other  
> persons the code seems strange and somewhat dificult to read.

I’m sorry, but I don’t understand what you’re getting at here. The  
three examples you gave:

a.+(3)  
a.+ 3  
a + 3

are actually the only ways to express that thought (without getting  
silly wrt parenthesis). Ruby explicitly makes parentheses optional  
on method calls. Parentheses make complex operations easier to read,  
certainly, and can prevent confusion for the interpreter and  
programmer, as when you have:

a b, c d  
// Is this a(b, c(d)) – OR  
// a(b), c(d)

This means only that “a + 3” is syntactic sugar for “a.+(3)” because  
it is fundamentally more natural for most people to write “a + 3”  
than either “a.+(3)” or even RPN “a 3 +”. Again, matz has made the  
proper choice – it keeps the language easily accessible.

> Sometimes SS is right, v.g. x +=1, but the every call is a method  
> aproach could give you the same results without trouble, in this  
> case += could be a method. As could be “++” or others.

Actually, it can’t give you the same results without trouble. C++  
_is_ trouble because it allows the definition of:

a = a + b // a.=(a.+(b))

to be different from:

a += b // a.+=(b)

If the result of the first call isn’t the same as the result of the  
second call, then there’s a disconnect which has to be documented.  
Matz made the right choice here, I think, because it prevents this  
sort of stupidity that C++ allows. (And this isn’t ‘prevention’ in  
the way that I think GvR was beyond silly to require indentation for  
block definition in Python.)

> Undeclared variables, I don’t know other people but I do fast  
> typing and writing “aVariable” and “aVariabel” is a mistake that I  
> can do very easily. Yes you can say, type more slowly, but this is  
> not a solution, I would like to have a way to force the compiler  
> to generate a warning when I use a non pre-declared (or pre  
> asigned) variable.

The interpreter will warn you of this, to some degree. If I try to  
use an undefined variable, it will complain (at least with 1.7)  
because the value is unknown (it’s not even properly ‘nil’). This  
won’t help, however, if you have two similarly named variables.

> Why are Strings arrays of integers ? aString[0] is an integer,  
> yes, it’s the way it is, but I would like to have String as an  
> array of chars, and char if you want as a descendant of Integer  
> (nice election because a Unicode String is and array of double  
> chars i.e. integer), I don’t know you, but for me aString[i].chr  
> ==‘x’ is somewhat unnatural, because it breaks the semantic of a  
> String, so it’s not intuitive for me.

This one is easy: because it was a design decision made earlier. A  
new version of String is being worked on, to the best of my  
knowledge, that will deal with characters – but this leaves the  
problem of existing code which will break because it uses the  
current implementation.

> Why is Ruby an interpreter ? Yes the less traditional bytecode  
> aproach, can be harder (or not), but enables external  
> optimizations more easily (JIT and similars) because the language  
> are separated from the implementation, enables reduced footprint  
> and gives faster execution times, yes, look at how Self executes  
> programs, it’s amazingly fast (and incredibly complex also), but a  
> separated implementation could help develop better Ruby-engines.

A bytecode system is being worked on, to the best of my knowledge.

-austin  
– Austin Ziegler, austin@halostatue.ca on 2002.11.03 at 00.12.35

> **···**
>
> On Sun, 3 Nov 2002 10:57:29 +0900, Enric Lafont wrote:

---

<div class="post-metadata">

**Author:** ![Enric\_Lafont](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@Enric\_Lafont](https://rubytalk.org/u/Enric_Lafont)\
**Post date:** [3 November 2002 20:20 UTC](https://rubytalk.org/t/sqlite/2439/16 "2002-11-03T20:20:07Z")

</div>

SORRY

I’ve sent the message TREE TIMES to the list.

But I’ve been receiving an error from the mailing list saying that the  
message have not been processed, and worse of all, the message have been  
hidden between other messages, so I can not see that the message has  
been delivered.

I’m so sorry, please accept my apologices for the mistake.

Enric

---

<div class="post-metadata">

**Author:** ![Vincent\_Foley2](https://avatars.discourse-cdn.com/v4/letter/v/f07891/32.png) [@Vincent\_Foley2](https://rubytalk.org/u/Vincent_Foley2)\
**Post date:** [3 November 2002 20:58 UTC](https://rubytalk.org/t/sqlite/2439/17 "2002-11-03T20:58:58Z")

</div>

When I started learning Ruby, some things didn’t feel natural (strings  
as integer arrays for example), but I eventually learned to cope with  
these and also, not think too much of the features I would like to have  
(conses, tail-recursion optimization, etc.) Language designers do their  
best to write a language that the actual community continues to like.  
Larry Wall listens to the Perl people and if their suggestions make  
sense, he probably adds them. Same goes for Guido Van Rossum and  
Python. And matz listens to the Ruby community (he’s pretty active in  
this ML).

Just give it time, eventually the large number of nice features in Ruby  
will make it easier for you to accept the little annoyances.

Oh, welcome in the Ruby world!

Vince

> **···**
>
> –
> 
> Vincent Foley-Bourgon  
> Email: [vinfoley@iquebec.com](mailto:vinfoley@iquebec.com)  
> Homepage: [http://darkhost.mine.nu:81](http://darkhost.mine.nu:81)

---

<div class="post-metadata">

**Author:** ![Massimiliano\_Mirra4](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@Massimiliano\_Mirra4](https://rubytalk.org/u/Massimiliano_Mirra4)\
**Post date:** [4 November 2002 14:46 UTC](https://rubytalk.org/t/sqlite/2439/18 "2002-11-04T14:46:26Z")

</div>

> Don’t get me wrong, I understand that Ruby is a young language that  
> needs some maturing,  
> […]  
> I want to make some suggestions for future releases,  
> […]  
> I’m still learning, and I’ve a loooong way before understand  
> everyting. I’m just looking for answers.

Are you trying to improve your understanding to fit Ruby or are you  
trying to improve Ruby to fit your understanding?

Beware, because it really looks like the latter, in spite of the  
closing sentence: you’re asking people not to be rude to you, yet  
you’re being rude by throwing judgement at what you admittedly aren’t  
familiar with.

Everyone here knows that it’s done in good faith and nobody will flame  
you; thankfully Ruby has got a nice community and anyway most of us  
wondered the same things once. I suggest you look through the  
archives, because the answers to your questions are all there, and  
follow Hal’s `ninety days’ advice. That way, people won’t get annoyed  
and think ``here’s another newcomer knowing nothing about Ruby and  
presuming he can improve it’'. Ok?

/me turns 180 degrees and speaks to the rest of ruby-talk:

Folks, what do you do when you see code like this?

```
c1 = 3 * 3 * Math::PI

c2 = 6 * 6 * Math::PI

c3 = 21 * 21 * Math::PI

```

You refactor, right?

```
def area(r)
  return r * r * Math::PI
end

c1 = area(3)
c2 = area(6)
c3 = area(21)

```

So we’ve got wisdom in programming. Can we please apply it  
in life, too?

It’s simply too much to leave the list for a couple of days and find  
half a hundred messages resurrecting topics (and beating them to death  
again) such as:

```
- Alternatives in syntax or `There is more than one way to write
  it'
- Overloading '='
- Declaring variables
- Compiling Ruby to bytecode or whatever

```

First it was because Ruby is different than Pythong, then because it  
is different than C++, now because it is different than Smalltalk,  
tomorrow because it is different than God knows what.

Can we (or at least those who still have energy to answer, and yes I’m  
cowardly leaving myself out) refactor this recurring `human code’ into  
a wiki or whatever, and redirect people there? We don’t want  
ruby-talk to become ruby-design-advocacy, right? And we don’t want  
matz to waste his time justifying design decisions (which thankfully  
he does very seldom already)?

William’s `List of things that newcomer to Ruby should know'' does a great job of satisfying the practical concerns (`How does it work  
like…?‘’). Something is needed for the philosophical/theoretical  
side (``Why is it like…?‘’).

Does this make sense?

Massimiliano

> **···**
>
> On Sun, Nov 03, 2002 at 10:57:29AM +0900, Enric Lafont wrote:

---

<div class="post-metadata">

**Author:** ![Anders\_Bengtsson](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@Anders\_Bengtsson](https://rubytalk.org/u/Anders_Bengtsson)\
**Post date:** [3 November 2002 11:53 UTC](https://rubytalk.org/t/sqlite/2439/19 "2002-11-03T11:53:54Z")

</div>

Albert Wagner wrote:

> Smalltalk is pure OOP. Ruby is not. In Smalltalk the “operators” are simply  
> messages to an object. In Ruby “operators” are neither objects nor messages,  
> but are rather handled as in more conventional languages. I don’t know why  
> Matz only went part way. This part-way-ness is also visible in other  
> aspects of the language such as “if”, “while”, etc. In Ruby these things  
> also are neither object nor message. Whereas in Smalltalk, such constructs  
> are messages to a Boolean object.

If Ruby went all the way on this, like Smalltalk does, then Ruby would  
almost _be_ Smalltalk.  
The unique about Ruby is that it combines the OO-ness of Smalltalk with  
a more conventional syntax. I love Smalltalk’s syntax, but it did scare  
a lot of people away.

(It can be argued that you could do “if” as messages internally, which  
is left as an excercise to the reader 🙂

/Anders

> **···**
>
> –
> 
> A n d e r s B e n g t s s o n | ndrsbngtssn@yahoo.se  
> Stockholm, Sweden |
> 
> * * *
> 
> Gratis e-mail resten av livet på www.yahoo.se/mail  
> Busenkelt!

---

<div class="post-metadata">

**Author:** ![Gavin\_Sinclair](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@Gavin\_Sinclair](https://rubytalk.org/u/Gavin_Sinclair)\
**Post date:** [3 November 2002 12:12 UTC](https://rubytalk.org/t/sqlite/2439/20 "2002-11-03T12:12:37Z")

</div>

> > [Enric:]  
> > Why are Strings arrays of integers ? aString[0] is an integer, yes, it’s  
> > the way it is, but I would like to have String as an array of chars, and  
> > char if you want as a descendant of Integer (nice election because a  
> > Unicode String is and array of double chars i.e. integer), I don’t know  
> > you, but for me aString[i].chr ==‘x’ is somewhat unnatural, because it  
> > breaks the semantic of a String, so it’s not intuitive for me.
> 
> It is not intuitive to many people. There have been long discussions on the  
> pros and cons.

It’s probably not intuitive to _anybody_ (except perhaps Matz). However, I see  
no particular justification for it being any other way, and in fact it’s  
changing in 1.7 isn’t it? Anyway, my point is: you’ll never forget it now.  
And if you’re like me, you won’t care either.

But to nitpick, a String is _not_ an array of integers. It is a String 🙂

Other options, if you’re testing equality of an individual character:

string[i] == ?x  
string[i,1] == “x”

Cheers,  
Gavin

> **···**
>
> From: “Albert Wagner” [alwagner@tcac.net](mailto:alwagner@tcac.net)

[Next page](https://rubytalk.org/t/sqlite/2439.md?page=2)
