-
Notifications
You must be signed in to change notification settings - Fork 34
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
let #747
Comments
P.S. If we're considering introducing a new keyword, then that is a decision we should make now before 1.0 goes final! |
It's got to be worth reviewing the other features we'd like for 1.1 in case there are other words we'd like to reserve before it's too late. |
@tombentley Don't worry, I'm on top of that ;-) |
+1 With let I could refactor this:
To a more Wikipedia-looking definition:
Without making it a block and introducing two values, which would make it 4 lines of code. Of course even better would be:
|
So shall I reserve |
Given that |
Although |
I would be fine with "given", too. |
I very weakly incline toward
But honestly I could go either way. |
I’m not sure I understand the purpose of this. Could you use value something = {
for (datum in data)
let (result1 = op1(datum), result2 = op2(datum))
[opX(result1), opY(result2), opZ(result1, result2)]
}; That would certainly be useful. EDIT: or is that #377? I’ve skimmed through the conversation, but it seems you discussed a whole lot of other things there as well that’s mostly unrelated… |
I have implemented |
So what's the syntax? I suppose it's a |
Yes, this is the one that confuses me the most. What does this do anyway:
It makes a tuple of two elements using the dist binding? It's just that all the examples given seem to be like this, so it almost seems that the |
let (x="hello", y="world") x + " " + y
Yes, of course.
Of course. |
Ok, so it's something like |
Why, is it allowed to have no bindings? What's the use-case? |
Sorry @FroMage , my mistake, it's actually: |
Of course not. |
OK, thanks. |
Should I do this one for the JVM then? |
Ok, with me, I'm not going very fast at the moment with my current issue :/ |
Go on then, I'll let you have this one. |
Haha. |
Done on the JVM in the |
Done on JS in the |
In fact this is not currently working. |
@chochos Fixed, I think. |
Yes, working now! This is why I think it's better to have some of these tests in the language module, even if they're not directly related to the language module itself; those tests are run on both backends. |
Branched merged. Done! |
Oh, wait, still need a spec! |
Spec done, closing! |
The spec used to define some operators via pseudocode let expressions like this: let x=y in e which, with the introduction of actual let expressions into the language (ceylon#747), can instead be written as: let (x=y) e rendering the previous syntax not only obsolete, but also confusing; see for example @PhiLhoSoft on the ceylon-users mailing list: https://groups.google.com/d/msg/ceylon-users/N3idC2CZQxI/N_-BaNdydzgJ
As Ceylon is gradually moving toward being more expression-oriented and less statement-oriented, let expressions are becoming more and more useful. There's been some explicit discussion of them in #377 and #744. I'm opening this issue because this is actually of course a separate, independently useful construct.
The syntax would be something like this:
Of perhaps, in order to avoid growing a new keyword, like this:
Note that this feature might let us simplify the syntax of
if
expressions in #503, since you could write stuff like this:I think we should make this one a priority for 1.1.
The text was updated successfully, but these errors were encountered: