Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overloading over different numbers of arguments not fully supported #630

Open
ngeiswei opened this issue Mar 20, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@ngeiswei
Copy link
Contributor

What is your problem?

Overloading a function with structure with different numbers of arguments confuses the interpreter.

How to reproduce your problem?

Run the following code

;; Unary lambda
(: λ (-> Variable Atom Atom))
(= ((λ $x $f) $y) (let $x $y $f))
!((λ $x (+ 1 $x)) 1)

;; Binary lambda
(: λ (-> Variable Variable Atom Atom Atom))
(= ((λ $x $y $f) $z $w) (let* (($x $z) ($y $w)) $f))
!((λ $x $y (+ $x $y)) 1 2)

What would you normally expect?

[2]
[3]

What do you get instead?

[2]
[3, 3]

What else do you have to say?

The following code

;; Unary foo
(: foo (-> Number Number))
(= (foo $x) (+ 1 $x))
!(foo 1)

;; Binary foo
(: foo (-> Number Number Number))
(= (foo $x $y) (+ $x $y))
!(foo 1 2)

properly works, indicating that the problem comes from the fact that the function is an expression instead of a mere symbol.

@ngeiswei ngeiswei added the bug Something isn't working label Mar 20, 2024
@luketpeterson
Copy link
Contributor

luketpeterson commented Mar 21, 2024

There was a discussion about var-args and arity in the context of the import op here: Much of the discussion is pertinent to var-args in general. #580 (comment)

@luketpeterson
Copy link
Contributor

Also, it seems like var-args support might be gated on #346 Although that should be fixable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants