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

Lambdas Silently Ignore Default Arguments #92

Closed
ImmutableOctet opened this issue Oct 11, 2016 · 1 comment
Closed

Lambdas Silently Ignore Default Arguments #92

ImmutableOctet opened this issue Oct 11, 2016 · 1 comment

Comments

@ImmutableOctet
Copy link

Lambda expressions don’t seem to work properly with default arguments. They’re treated as if they weren’t assigned. This would be fine if it’s the intended behavior, but an error message is not provided. Assuming default arguments are intended to work, then this is a bug, rather than a missing error.

_Testing was performed with mx2cc version 1.0.7._

Example:

Function Main:Void()
    Local f:= Lambda(msg:String="Hello world.")
        Print(msg)
    End

    For Local i:= 0 Until 200
        f()
    Next

    f("Done.")

    Return
End

Presuming the rules for lambdas are the same as functions, this should output "Hello world." 200 times, then output "Done.".

MX2CC currently produces an error claiming that no arguments were given, ignoring the default assignment, for better or worse.

monkey2/tmp/untitled1.monkey2 [7] : Error : Wrong number of arguments - expecting 1 not 0

<Original forum thread>

@blitz-research
Copy link
Owner

Ok, have prohibited default params for lambdas for now.

blitz-research pushed a commit that referenced this issue Dec 6, 2017
blitz-research pushed a commit that referenced this issue Mar 8, 2018
43463bbc Merge branch 'dev'
0aa04b88 Updated 3d template file.
2c72b18b Added patron info (#115)
9f8950c9 Changed SourceCodePro.ttf to SourceCodePro.otf due to missing 'missing' glyph.
30b71654 Merge branch 'dev'
a5e6ac96 Improved removing whitespaced trailings.
bd606b5e Added "Remove lines trailing" feature (enabled by default).
fde8e555 Bump app version.
814ecffd Improved support of array type in code completion and code tree view.
1bf57792 Now storing latest opened tab in prefs dialog.
c14b7280 Added "Rename folder", and open a *folder* by "open file on desktop".
a80fe7e2 Updated special thanks.
d40bf4d4 Added shortcut (Ctrl+Shift+D) for duplicate line or selection (#90)
e32dfab7 Added some preprocessor directives.
799ef412 Improved "fix indentation" logic.
8b747870 Added shortcut text for "Stop process" button in status bar.
652924fa Completion list - some colors added into theme file (#103)
7ab83d27 Removed IRC stuff (#105)
ab276f07 Improved "spaces as tabs" convertion. (#98)
2476c50b More work on tabulation.
2d7a16b6 New feature - using spaces as tabs! (almost done)
64219e7c Disabled tabs undocking until there is no support for multi-window apps.
8fb4bf2d Merge branch 'master' into dev
a21bf249 Themes fixes by Hezkore.
cad986d0 Fix wrong View size afer restart and reload Undock Window (#112)
3599a22a Merge branch 'v2.8.1' into dev
86369138 Fixed tabs moving after drag-n-drop them.
c67124bc Undock tabs v2 (#109)
b82b1c29 View Mod (#108)
ba39705c Fixed text.
8e6d4cf4 Fixed #101 - make locked latest file just opened by double-click (via extension association).
052102d7 Updated mojo3d app template.
846935d1 Added ".glb" support to ted2go.
1267a050 Fixed SceneDocument to work with new mojo3d.
4d2d9577 Added a record to console about building cancellation.
720be2dc Close pop-up parameter hints by Escape.
d580b2ae Fixed #92 - minor focus issue.
da00ab0b Added jumping to error line right from Console view.

git-subtree-dir: src/ted2go
git-subtree-split: 43463bbcb22a7ad759e82972a9bacd317d3bcc86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants