Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2024-05-20
12:59 • Closed ticket [7a0f53f43c]: Arguments of empty constructor not checked properly<... artifact: ab34d103fc user: dkf
12:53 • Ticket [7a0f53f43c]: 5 changes artifact: 465b9f3256 user: dkf
2024-03-14
10:33 • New ticket [7a0f53f43c]. artifact: 506c5fda8b user: AlanGrunwald

Arguments of empty constructor not checked properly

Closed / Invalid7a0f53f43c39a69d5a17f41b29f512ba39dfa05eCreated 3 years agoUpdated 3 years ago
Descriptionmarkdown2024-03-14 10:33:15

Consider:

% info patchlevel
8.6.13
% oo::class create foo {constructor {} {}}
::foo
% set f [foo new a b c]
::oo::Obj12

It seems that if the constructor has any definition, then the arguments are checked properly

% oo::class create foo {constructor {} { }}
::foo
% set f [foo new a b c]
wrong # args: should be "foo new"
dkfmarkdown2024-05-20 12:53:41

Confirmed, in 8.6 and (just off) the main branch tip.

dkfmarkdown2024-05-20 12:59:26

Ah, no! It's documented as something that is that way by design.

If bodyScript is the empty string, the constructor will be deleted.

Destructors behave the same way.

Log in (anonymous is fine) to add a comment.