develooper Front page | perl.perl6.internals | Postings from October 2001

Ord, v0.3, and ideas on chr

Thread Next
James Mastros
October 23, 2001 00:01
Ord, v0.3, and ideas on chr
Message ID:
Hey all.
  This is a much nicer implementation of ord, which does it properly as a
string encoding "method".  
  The only real uglyness I see is the "I have no mouth and I must scream"
problem.  I could take a Perl_Interpreter * parameter, but the only reason I
need it is to fire off exceptions.

WARNING:  This only implements the encoding method for strnative.  This
isn't really so much a problem, since it's impossible to make strings in
other encodings, and I wanted to get this off to see if the style is good
before I figure out utf8 and utf16 versions of this (utf32 should be
trivial).  There is a halfharted attempt to make it die cleanly if this
happens, but there's nothing to guarantee that the compiler will put a NULL

Please tell me any problems you see with this.  

I don't see what chr() should look like, though.  What's the interface to
multiple encodings on the opcode level?  I'd like to just say that chr
always creates a utf32 string.  String encodings don't have fixed numbers in
a plugable-encoding world (and I assume that's where we're going), so I
can't take an i|ic parameter for that.  String encodings are an enum, so I
can't take the name of the encoding as an s|sc parameter.  Ideas?

      -=- James Mastros

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About