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.
Local f:= Lambda(msg:String="Hello world.")
For Local i:= 0 Until 200
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  : Error : Wrong number of arguments – expecting 1 not 0
Can you post this to github issues, so it doesn’t get ‘lost’?
Started an issue. I presume GitHub’s the correct place to post bugs, then? I originally intended to post to GitHub, but I didn’t know if this was intended behavior or not.
I presume GitHub’s the correct place to post bugs, then?
Yes, I’ve grown to like it a lot compared to my old ‘bug reports’ forum approach.
I didn’t know if this was intended behavior or not.
When in doubt, post, I can always just chuck it later.
I’m really glad you’re adopting GitHub as a part of bug tracking and discussion.
Just for the record, you know the creator of a repository can also open issues, right? In other words, if you end up finding a bug you want to fix later, you can add and document it.
You must be logged in to reply to this topic.
Monkey2 is an easy to use, cross platform, games oriented programming language from Blitz Research.