Tcl Source Code

View Ticket
Login
Ticket UUID: 3483088
Title: [tailcall next] doesn't work ... should it?
Type: Bug Version: obsolete: 8.6b2
Submitter: coldstore Created on: 2012-02-02 06:58:57
Subsystem: 10. Objects Assigned To: dkf
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2012-02-10 21:15:25
Resolution: Works For Me Closed By: dkf
    Closed on: 2012-02-10 14:15:25
Description:
[tailcall next] complains spuriously that 'next may only be called from inside a method' even when it is.  See attached.

I think I have another problem related to this, where [tailcall next] is complaining spuriously 'wrong # args: should be "next"', but will see how this one pans out.
User Comments: dkf added on 2012-02-10 21:15:25:

allow_comments - 1

[tailcall foo] is like [return [uplevel foo]] apart from some quoting issues and the context in which [foo] is resolved. (But there's only one [next], so the resolution will be consistent.) Thus, [tailcall next] only works at all when the _caller_ of the object can do a [next], which means that it needs to be done inside a method called from inside a method. I'm guessing that that's something you don't need. :-) It's complaining about the wrong # args because that's what the caller's next method implementation wants (I guess).

So... it works, but not in the way you would reasonably want. (Remember, [next] effectively does an [uplevel] inside itself so methods don't need to know about potential subclasses overriding them. It also _requires_ that the caller be an object method body context, since it uses that to know what is going on.) To do anything else would require teaching [tailcall] to know specially about [next] and vice versa, which would be rather disgustingly nasty.

coldstore added on 2012-02-02 14:32:55:
I guess, by the time the [next] is called, the [tailcall] has already taken effect, and somehow the context is no longer that of an object.  Shouldn't it be, though?

coldstore added on 2012-02-02 14:13:57:

File Added - 434664: tailcall.tcl

coldstore added on 2012-02-02 14:13:41:

File Deleted - 434661:

coldstore added on 2012-02-02 14:13:13:

File Deleted - 434663:

coldstore added on 2012-02-02 14:12:57:

File Added - 434663: tailcall.tcl

coldstore added on 2012-02-02 13:58:58:

File Added - 434661: tailcall.tcl

Attachments: