Larry Wall wrote:
On Mon, Sep 25, 2006 at 09:02:56PM -0500, Mark Stosberg wrote:
: : eval($yaml, :lang<yaml>); : : Still, these options may not substitute for the kind of role-based
: solution you have mind.

I'm not sure it's wise to overload eval this way.  Seems like a
great way to defeat MMD.  Plus I really want a file interface so I
don't have to slurp a 37M string, which in turn requires a 400M stack
allocation currently.  Seems to want even more heap after that, and
then it really starts thrashing...

Not everything has to be done via MMD, of course, and more to the point, many things can play nice with MMD.

        multi sub eval(Str $data, Str :$lang) {
                given $lang ->{
                        when 'perl'  { perl_eval($data)  }
                        when 'yaml'  { yaml_eval($data)  }
                        when 'perl5' { perl5_eval($data) }
                        when 'pir'   { pir_eval($data)   }
                        when 'pbc'   { pbc_eval($data)   }
                        when defined { call } # Back to MMD!
                        default      { perl_eval($data)  }

BTW: for the above, it would be nice to be able to say:

        when m:i/^perl$/ {...}

without all the "noise". That is, it would be nice to have something like:

        when 'perl':i {...}

Dunno if that makes any sense or not.

Reply via email to