Skip to content
Tcl Source Code View Ticket
Login

View Ticket

magic empty body misfeature

Closed / Accepted1959483fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2008-05-07 12:45:18
As mentioned before:

http://aspn.activestate.com/ASPN/Mail/Message/tcl-core/3316773

% namespace path oo
% object create foo
::foo
% define foo method x {} {}
% foo x
unknown method "x": must be destroy

Contrast with:

% define foo method w {} {#}
% foo w
%

This is a repeat of the misfeature of
[bind] to give magic treatment to
a perfectly valid body value -- the
empty string.  It's analogous to the
[rename $cmd {}] misfeature that similarly
abuses a perfectly valid command name.

I'd prefer an [undefine] command to 
destroy method definitions, analogous
to the [unset] command, where we've
properly not given magic unsetting
properties to [set v {}].
dkf Ticket [1959483fff]: 1 change [History diff]2008-05-08 22:20:46
dkfplain2008-05-08 22:37:20
Logged In: YES 
user_id=79902
Originator: NO

I think this is a valid point of view.
dkfplain2008-05-11 17:12:38
Logged In: YES 
user_id=79902
Originator: NO

Implemented a 'deletemethod' subcommand of oo::define and oo::objdefine. Also done a 'renamemethod'.
Log in (anonymous is fine) to add a comment.