Re: Discuss changing the behaviour of append()

new topic     » goto parent     » topic index » view thread      » older message » newer message
gimlet said...

Well - that is interesting,

You pass a sequence to append,
Append checks that it got a sequence.
Double work.

IIUC this is only the case using the interpreter. The translator does not seem to check.

gimlet said...

It seems to me that append is entitled to crash if you pass in an atom. That it actually checks before dying...

Well, in general having a human readable error message is quite helpful. But for this to happen (and this generally doesn't happen with the translator btw), something needs to check somewhere.

gimlet said...

Leaving aside the convenience of append(1,2) as opposed to {1,2} or 1 & 2.

Isn't it true that if you don't know X is a sequence you shouldn't be appending to it?
Isn't this what types are about?

Isn't this to say that it is up to the caller to ensure that the parameters are of the correct type.

and

It is not up to the called function to validate its parameters.

Agreed, the language itself should do that validation. Which is what actually happens.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu