* Alan Grunwald <
nospam.nurdglaw@gmail.com>
| > On 14/03/2024 09:52, Alan Grunwald wrote:
| > I've raised ticket [7a0f53f4] in the core fossil repo - I hope
| > that's the right place.
| > In the course of reformulating the example, I discovered that a
| > single space is sufficient to cause he arguments to be checked.
| >
| I've had a response to this ticket from Donal Fellows. He drew my
| attention to the statement in the contructor section of the oo::define
| manpage that reads "If bodyScript is the empty string, the constructor
| will be deleted". This certainly explains the difference in behaviour
| between
| oo::class create foo {constructor {} {}}
| and
| oo::class create foo {constructor {} { }}
| However, I wasn't expecting that if I fail to specify a constructor
| explicitly when defining a class, then the default constructor accepts
| any (or no) arguments. It strikes me that if you don't define a
| constructor then you'd expect the default constructor to accept *no*
| arguments and that if you later create an instance of the class
| passing some arguments, then that creation is an error.
I'd second that. This is how c++ does it (there even the
wrong type of argument results in compilation error).
| If enough people agree with me, I'll have a go at persuading Donal to
| reopen the ticket and change the default constructor.
I would think that if I need a CTOR which accepts (and probably
discards) any number of arguments, then creating one accepting 'args'
would be the way to go.
R'
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)