Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Small examples of string eval

by spurperl (Priest)
on May 13, 2006 at 07:28 UTC ( #549195=note: print w/ replies, xml ) Need Help??


in reply to Re: Small examples of string eval
in thread Small examples of string eval

By newbies I don't mean people who've learned to program Pascal yesterday, but rather programmers from other languages who don't yet grok the concepts of runtime evaluation and code generation.

Thanks for the example, but it's not what I'm looking for. Your example is very idiomatic to Perl, I'd say it's a patch on a deficiency, because I have no trouble imagining tr/// implemented in such a way that allows the trick without eval.

What I'm looking for is more in the code-generation league. Generate some code with eval, on the fly, and call it when necessary.


Comment on Re^2: Small examples of string eval
Re^3: Small examples of string eval
by ikegami (Pope) on May 13, 2006 at 07:44 UTC

    Major code generation is usually used when a language is inept (or not particularly adept) at doing something. Off the top of my head, I can think of three reasons why a language would be inept at doing something

    • 1) A language could be inept at doing something because it lacks the specialization that would make it adept. Querying databases (facilatitated by SQL), generating parsers (facilitated by BNF or similar) and generating object accessors would fall in this category.

    • 2) A language could be inept at doing something because it lacks the generalization that would make it adept. For example, working with Java Bytecode is more tedious than working in Java, so we do the work in Java and generate the Java Bytecode.

    • 3) A language could be inept at doing something because it is primarily text based and/or non-interactive, and a GUI and/or interactive solution would be more adept. For example, GUI builders are often used to build GUI code.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://549195]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (14)
As of 2014-08-27 12:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (238 votes), past polls