Skip to content

Why calling a lambda in expressions causes an error #2886

Closed Answered by Vurv78
xbyte3 asked this question in Q&A
Discussion options

You must be logged in to vote

Lambdas are typed erased to just being a single function type. That's how tables and arrays work too.

So whenever you call a lambda, the compiler needs to know what return type you're expecting, to check the signature (stored at runtime).

This comes from

  1. String calls working the same way
  2. Very strict / generic typing being very foreign to E2 (dunno if the leap will ever be made in E2, might be a reason for E3 to happen)
  3. Type system / extension system would need to be changed (potentially not that much, could just store fn signatures as fn(a,b,c):d)

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Vurv78
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Vurv78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #2885 on November 21, 2023 23:03.