Definitions

from Wiktionary, Creative Commons Attribution/Share-Alike License

  • n. An evaluation strategy in which the arguments to a function are evaluated when the function needs to use them.

Etymologies

Sorry, no etymologies found.

Examples

  • Caching of this sort is what distinguishes call-by-need from call-by-name and allows lazy evaluation to work efficiently for data representations.

    Planet Haskell

  • The application of call-by-name as a substitute for full-blown macros isn't novel either.

    raganwald

  • Functions with call-by-name semantics communicate the same thing as blocks: The expressions are to be consumed by the function.

    raganwald

  • But it feels like a move in an interesting direction: if it is a win to sometimes meta-program Ruby's syntax with DSLs, it ought to also be a win to sometimes meta-program Ruby's semantics with call-by-name functions.

    raganwald

  • For that reason, I prefer call-by-name semantics when an expression is not meant to be persisted beyond the function invocation.

    raganwald

  • As is standard with the rewrite gem, only the code in the do ... end block is affected by your change. call-by-name, in summary

    raganwald

  • You can write your own functions with call-by-name semantics using called_by_name just as you see here.

    raganwald

  • We could argue that since our call-by-name functions have different behaviour than ordinary functions or methods, they ought to have different syntax.

    raganwald

  • As you can surmise from the fact that it has a name, it is not some newfangled shiny toy idea, it goes back to ALGOL 60, where it was known as call-by-name.

    raganwald

  • One thing that's interesting to notice about this strategy is that it seems stricter than call-by-name.

    Planet Haskell

Comments

Log in or sign up to get involved in the conversation. It's quick and easy.