in reply to Perl 6 wish list: pack/unpack meta-feature

Here's something vaguely related in State of the Onion --
Larry mentioned that overloading was a headache; you hate it in languages that have it, and you hate it when languages don't have it. Sometimes there are gratuitous abuses of overloading, such as C++'s left-shift operator to add more arguments to a function. The overloading system will be a lot cleaner, by specifying operators as special method names. The vtable system will be leveraged to provide overloading on objects. There will also be overloading hooks in printf so that new formats can be defined.

he's probably open to the idea of custom (un)pack formats if he plans on custom printf formats, if the two aren't part & parcel.
  • Comment on Re: Perl 6 wish list: pack/unpack meta-feature (boo)

Replies are listed 'Best First'.
Re: Re: Perl 6 wish list: pack/unpack meta-feature (boo)
by John M. Dlugosz (Monsignor) on Jul 26, 2001 at 19:08 UTC
    I agree, if he's open to one he should like the other too. But I don't think they’re "part & parcel".

    We already have user-defined objects in printf, by virtue of their string-ize overload. %s will basically tell any object to render itself in the default manner.

    What I suppose he's talking about are formats like d for decimal and h for hex. Maybe define a way to specify rectangular or polar for complex numbers, for example.

    —John