[V2.0.2:] Uncorrect loadtime check for f(unset)

Report problems with documented functionality
User avatar
V2User
Posts: 195
Joined: 30 Apr 2021, 04:04

[V2.0.2:] Uncorrect loadtime check for f(unset)

Post by V2User » 27 Jan 2023, 09:02

Uncorrect loadtime check for f(unset).
See this code:

Code: Select all

f(){
}
ff:=f
ff([unset,unset]*)    ;It can run
ff(unset,unset)      ;It can run
f([unset,unset]*)    ;It can run
f(unset,unset)       ;It cannot run and will throw a load time error which should never happen.

lexikos
Posts: 9553
Joined: 30 Sep 2013, 04:07
Contact:

Re: [V2.0.2:] Uncorrect loadtime check for f(unset)

Post by lexikos » 15 Feb 2023, 01:55

It is by design. What is the purpose of such code?

User avatar
V2User
Posts: 195
Joined: 30 Apr 2021, 04:04

Re: [V2.0.2:] Uncorrect loadtime check for f(unset)

Post by V2User » 09 Mar 2023, 11:05

lexikos wrote:
15 Feb 2023, 01:55
It is by design. What is the purpose of such code?
@Lexicos
I think f(unset,unset) should keep the same as ff(unset,unset) rather than one can run but the other cannot. Because they are one same function.
viewtopic.php?f=24&t=110696#:~:text=Fixed%20trailing%20unset,count%20toward%20MaxParams.
Fixed trailing unset in f(a?, b*) to not count toward MaxParams.
Also, f(unset,unset) should keep consistency with the change of RC.2.
This is the opinion the code tries to make.

lexikos
Posts: 9553
Joined: 30 Sep 2013, 04:07
Contact:

Re: [V2.0.2:] Uncorrect loadtime check for f(unset)

Post by lexikos » 10 Mar 2023, 01:16

Load-time validation of parameters is only possible for formally defined functions, not for variables which can be assigned anything at the time the function is eventually called. The only way to make them fully consistent in general would be to remove valuable load-time validation.

Since you haven't answered my question, I conclude there is no purpose.

User avatar
V2User
Posts: 195
Joined: 30 Apr 2021, 04:04

Re: [V2.0.2:] Uncorrect loadtime check for f(unset)

Post by V2User » 19 Mar 2023, 03:25

The only way to make them fully consistent in general would be to remove valuable load-time validation.
Since you haven't answered my question, I conclude there is no purpose.
My purpose is to remove the valuable load-time validation only for func's unsset value. But now I have found it is hard to achieve in load time. :think:
Thank you for your reply.

lexikos
Posts: 9553
Joined: 30 Sep 2013, 04:07
Contact:

Re: [V2.0.2:] Uncorrect loadtime check for f(unset)

Post by lexikos » 27 Mar 2023, 01:46

My purpose is to remove the valuable load-time validation only for func's unsset value.
That is what you want to do in order to allow your unexplained code to run. It is not the purpose of your code, or the purpose of specifying "unset" for parameters that clearly couldn't ever accept a value.

Post Reply

Return to “Bug Reports”