From: mike@... (Mike Stok) Date: 2003-06-20T01:46:36+09:00 Subject: Re: Multiple Initialize methods? In article <20030619144253.10746.qmail@web12404.mail.yahoo.com>, Michael Campbell wrote: > >> > > They are not type-less there are dynamically typed. >> > > Doing >> > > a = 1 + "1" >> > > doesn't work in Ruby, but does in Perl, for example. > > >Not to nit-pick here, but in perl aren't "1" and 1 the same type >("scalar") but different contexts? > >Or is that just a semantic nit? The context is provided from the program text and affects what gets pulled out of a scalar; a scalar in Perl has slots for integer value, number value and string value (being fast & lose with terms here) which get generated on demand. Usually they are "intuitively" related e.g. $i = 1; # sets IV slot to 1 print $i . "\n"; # sets PV (string) to contain "1" print $i + 0.1, "\n" # sets NV to 1 But sometimes the string isn't the representation of the number (e.g. $! [mike@ratdog Mail]$ perl -e '$! = 1; print $! + 0, "\n$!\n"' 1 Operation not permitted (Hope I haven't lied too much here...) Mike -- mike@stok.co.uk | The "`Stok' disclaimers" apply. http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA mike@exegenix.com | Fingerprint 0570 71CD 6790 7C28 3D60 http://www.exegenix.com/ | 75D2 9EC4 C1C0 0599 13DA