Wed Aug 23 16:07:59 CEST 2000
On Wed, Aug 23, 2000 at 02:04:16PM +0100, Sean Hinde wrote:
> 2. I guess any solution to finger trouble in atoms is getting towards a
> proper type system. Maybe something which could be declared at the start of
> a module which restricted the set of atoms which could be defined in the
> source for that file would do 80% of the job. Language Guru help needed!
Of course, you've just doubled the liklihood that you'll miskey the
symbol, since that's one more CRITICAL time you'll have to type it.
I'm not sure there's an automated way to avoid problems like this,
save to use an integrated editor that only LETS you enter an
identifier/symbol once and ever after provides a pulldown for it.
That's not really a "language issue," though.
> 3. Well, a string type would help!! Barring that to implement something like
> in Java (ironically strongly typed) where you can send any rubbish into a
In my experience, the best way to deal with this is to write a
function that, given an Object, returns a string representation of
that Object to the best of its ability. This is the way Python
handles the problem, and I find it rather convenient. The "%s"
directive automatically calls an Object's __str__ attribute which
returns a string representation. Erlang could get away with providing
an extensible function (possibly in string:) that handles Objects
known about. An easy way to extend its functioning without some kind
of type-checking or OOP encapsulation eludes me, however.
Alexander Williams () | In the End,
"Blue Jester needs food." | Oblivion
"Blue Jester needs fuku-wearing cuties." | Always
http://www.chancel.org | Wins
More information about the erlang-questions