Re: Telnet "More?"



7stud -- wrote in post #993403:
Yes, that would be pointless, but where does such a function appear in
your code?

That would be (I thought) the 'out' lambda, but as Christopher
explained, print is actually a *method* (not obvious if you don't know
Ruby), so it makes more sense that a closure is required.

In Lua, for instance, print is a global function, so making a closure
'function out(...) print(...) end' would be utterly superfluous;
anything you could pass 'out' to you could just pass 'print' to.

It still strikes me odd that Kernel#print is not static (does it modify
Kernel state?), or if it *is* static that you can't just pass it as-is
to anything that requires a callable.

--
Posted via http://www.ruby-forum.com/.

.



Relevant Pages

  • Re: closures and dynamic binding
    ... The double lambda is conceptually more sound in some ... I agree that the default argument syntax is an abuse, ... don't think there's a way to create a closure in Python without ... overrides the outer scope. ...
    (comp.lang.python)
  • Re: Lisp in hardware
    ... > pre-computed index into an environment. ... You have to "pre-compute" a LAMBDA just as much (or rather, ... because the closure object has to hold the captured lexical ...
    (comp.lang.lisp)
  • Re: Cost of closures
    ... a closure consists of a piece of code and a set of lexical ... by the same lambda while the environment part is different. ... in a register or on the stack. ... it must indirect through the `this' pointer. ...
    (comp.lang.lisp)
  • Re: I thought this was the one that worked?
    ... It's still a closure. ... closure for a block regardless. ... That lambda still has a reference to ...
    (comp.lang.ruby)
  • Re: Anonymous methods, blocks etc. (Cont. default block params)
    ... What does "closure capabilities" mean ... >> so far suggested for anonymous functions. ... > for def style semantics (i.e. 'true' anonymous function, opaque scope, ... in a lambda, it will return from the lambda only. ...
    (comp.lang.ruby)