Call for commentary: review of Ruby for a magazine (long, sorry!)

Btw, if this mailing list is hostile to OT chatter, I’m fine with taking
such conversations to private channels. I’m new here, so be gentle. =)

I’m looking for resources on getting Ruby running on an HP 200lx:
http://www.hp.com/cposupport/prodhome/pt200lx.html
This is an 8086.

That’s a fascinating idea… at first I thought
it might be implausible, but then I remembered
that Windows 3.0 (but not 3.1) will actually
run on this platform.

Hey, I was about to sell my old HP… but if
you accomplish this, it might be just enough
reason (read: excuse) to keep it. :slight_smile:

I got 32MB of memory and a doublespeed upgrade for my 200lx. It’s a
completely different beast with the additions. As soon as I get around
to it, I’ll have some of that space used as EMM too. =)

I’ve been told that windows 3.0 is a pig and won’t run particularly
well… but everything I’ve been running on my palm so far has been great
so I’m hoping Ruby works well.

Right now, I’m only barely competant at dealing with this sort of
software, letalone doing actual programming. I’m a natural with
scripting though, so i’m hoping things work out. I take my 200lx
everywhere with me, so i’m hoping I can do this too… heh. Yes, if i
were to become competant enough, I’d take care of supprorting a DOS
16bit port myself. Heck, I’m still thinking of taking over the hplx
games site and some other stuff… the only prospects which exist for
replacing this babe are a java/linux palm, and the eightythree.

http://www.tiqit.com/eightythree.html

Btw, I was also looking at doing some hardware hacking and adding in
backliting… others have done it, but it’s supposed to be rather
difficult… I think I may put in led’s and have a rim of light around
the screen. I also wanted to tear it apart and make it a couple of cms
smaller by removing excess case, but that’s on the back burner right now.

OT: I don’t suppose you know how to get a
Sundisk card to work properly under Windows ME?
I’ve been trying to suck the old data off onto
my laptop. Lost my connectivity cable long ago.

Cheers,
Hal

Do you mean “Sandisk”? I’m familiar with that particular brand… I’ve
been able to stick my card into a laptop and trade between it and a palm
without any special drivers or whatnot. The laptop was also a winME
box. If you don’t have a connectivity cable, I can find the resources
for you to hack your own if you’re brave, otherwise you can purchase
them relatively cheaply here:
http://www.palmtoppaper.com/store/asp/prodtype.asp?prodtype=36
Your choice of transfer methods. =)
You may want to look into doing an IR transfer. I’ve never done it
myself, but it’s supposed to be easy enough. There is a windows
software package that HP provide(s|d) which understands the laplink
stuff native on the palm. (I can get it for you easily enough, I
maintain an archive on the side)

···

Cheers,
Sy

William Djaja Tjokroaminata billtj@z.glue.umd.edu writes:

        if obj.nil?: puts "warning"

I think I have minimized my typing (good for my hands)

Except the conventional Ruby syntax

          puts "warning" if obj.nil?

is actually one less keystroke, and a shifted key one that (on my
keyboard…)

It seems to me that all you’ve really saved is typing ‘end’
keywords. If you happened to use Emacs, there’s a neat function called
g0-ruby-end-block that automatically inserts the ‘end’ and adjusts the
indentation when you type (in my case) ALT-Return.

I’ve been translating some Python in to Ruby, and I’m finding that if
I use Ruby idioms, rather than just copy the code statement for
statement, the Ruby is about 10-15% fewer statements than the
equivalent Python. I’m not sure that losing the 'end’s will really
make that much difference.

Cheers

Dave

“William Djaja Tjokroaminata” billtj@z.glue.umd.edu wrote in message
news:amv0od$7o3$1@grapevine.wam.umd.edu…

(regular Ruby code)

#begin_rbs --------------------------------------

class MyClass
    def initialize (obj)
        if obj.nil?: puts "warning"
    def do_something (arg)

That’s nice - but it is not clear whether indentation is important in your
syntax. I guess it is, since you can have nested class definitions.
You can probably get rid of the need for indentation by having a memberclass
keyword for creating a nested class definition.

I like things to begin and end to avoid ambiguities, but on the other hand
I find it rather annoying that 75% of Rubycode is made up of begin and end
statements. I have a similar problem with XML, HTML and sometimes LaTex.

I’m actually working on a similar construct for text entry: (simplified)

{chapter the chapter heading}
normal text inside chapter
{section a section header}
normal text inside section
{section the next section header}
normal text {bold this is bolded text}
{chapter the next chapter heading}
normat text

This format is not dependent on identation (curly braces only relevant
because I don’t want to escape text).

This can be translated into XML. The tag keywords following curly brace have
been defined as either a normal tag (like bold) or a block tag, like
chapter. Normal tags begin after the keyword and end at the right curly
brace. block tags have parents e.g. section has chapter as parent and
chapter has document (not shown) as parent. block tags have both a header
text (inside the curly braces) and a body text (after the curly braces).
When a new block tag at same or higher block level is discovered, the
current tag (and open children) are closed.

I hope this can be made into a Wiki syntax format one day - such that it can
also be used for single source documentation.

Mikkel

A question to the ELISP hackers aboard: Emacs already allows several
modifications of the appearance of code – I’m thinking about the
hide-show-mode, that hides a block’s content and only shows its
header, and the glasses-mode, that shows CamelCase as Camel_Case.

Below the surface, there’s still CamelCase, and of course the block
body is still there. Would it be difficult to hide the `end’ keywords
(both in reading and, somehow, in writing), for those fond of
Python’s syntax?

Massimiliano

···

On Thu, Sep 26, 2002 at 09:39:53PM +0900, dblack@candle.superlink.net wrote:

I’ve been lately thinking of the coolness of having several different
syntaxes for the same underlying “language”, especially if some tool is
able to translate between them… Imagine having a Python-esque syntax
w/ significant spaces in Ruby. That could for sure lure some pythonists :wink:

Interesting…I usually do:

puts “warning” unless obj

Since obj is true if not nil

The “if obj.nil?” may appear clearer, but ‘unless obj’ is easy to
grok as well. And of course this works only for cases where obj
is not a boolean value…

-rich

···

-----Original Message-----
From: dave@thomases.com [mailto:dave@thomases.com] On Behalf
Of Dave Thomas
Sent: Thursday, September 26, 2002 9:54 AM
To: ruby-talk ML
Subject: Re: call for commentary: review of Ruby for a
magazine (long, sorry!)

William Djaja Tjokroaminata billtj@z.glue.umd.edu writes:

        if obj.nil?: puts "warning"

I think I have minimized my typing (good for my hands)

Except the conventional Ruby syntax

          puts "warning" if obj.nil?

is actually one less keystroke, and a shifted key one that (on my
keyboard…)

I like things to begin and end to avoid ambiguities, but on the other hand
I find it rather annoying that 75% of Rubycode is made up of begin and end
statements. I have a similar problem with XML, HTML and sometimes LaTex.

Totally agree, Mikkel, I also found too many “end”'s.

I’m actually working on a similar construct for text entry: (simplified)

{chapter the chapter heading}
normal text inside chapter
{section a section header}
normal text inside section
{section the next section header}
normal text {bold this is bolded text}
{chapter the next chapter heading}
normat text

This format is not dependent on identation (curly braces only relevant
because I don’t want to escape text).

That’s is a good idea. I just don’t depart too far from Ruby yet, as the
translator will become too complicated for me :slight_smile: Have you taken a look
at the new Curl language (www.curl.com), which is a new language for the
Web?

Regards,

Bill

···

MikkelFJ mikkelfj-anti-spam@bigfoot.com wrote:

Hi,

To hide the ‘end’ keywords in writing is definitely possible, as in my
SRuby that I wrote in one-day (not heavily tested at all). To do the
other way (for reading), I think it is also definitely possible and
probably even easier (but I think it probably should be done in the
emacs-way, i.e., to hide them only on display).

Regards,

Bill

···

=============================================================================
Massimiliano Mirra list@nospamchromatic-harp.com wrote:

On Thu, Sep 26, 2002 at 09:39:53PM +0900, dblack@candle.superlink.net wrote:

I’ve been lately thinking of the coolness of having several different
syntaxes for the same underlying “language”, especially if some tool is
able to translate between them… Imagine having a Python-esque syntax
w/ significant spaces in Ruby. That could for sure lure some pythonists :wink:

A question to the ELISP hackers aboard: Emacs already allows several
modifications of the appearance of code – I’m thinking about the
hide-show-mode, that hides a block’s content and only shows its
header, and the glasses-mode, that shows CamelCase as Camel_Case.

Below the surface, there’s still CamelCase, and of course the block
body is still there. Would it be difficult to hide the `end’ keywords
(both in reading and, somehow, in writing), for those fond of
Python’s syntax?

Massimiliano

Hello Rich,

Thursday, September 26, 2002, 6:16:27 PM, you wrote:

          puts "warning" if obj.nil?

puts “warning” unless obj

it’s nothing compared to perlish “open or die” idiom :slight_smile:

···


Best regards,
Bulat mailto:bulatz@integ.ru

“Rich Kilmer” rich@infoether.com writes:

Interesting…I usually do:

puts “warning” unless obj

Since obj is true if not nil

The “if obj.nil?” may appear clearer, but ‘unless obj’ is easy to
grok as well. And of course this works only for cases where obj
is not a boolean value…

It’s ever so slightly faster, too.

time ruby -e ‘nope = nil; 1_000_000.times { x = 42 unless nope }’

real 0m0.924s
user 0m0.920s
sys 0m0.000s

time ruby -e ‘nope = nil; 1_000_000.times { x = 42 unless nope.nil? }’

real 0m0.994s
user 0m0.980s
sys 0m0.010s

Jim

···


Jim Menard, jimm@io.com, http://www.io.com/~jimm/

A Ruby script that prints all the digits of pi (sorted).

(0 … 9).each { | i | print i while true }