-
Notifications
You must be signed in to change notification settings - Fork 62
let #3853
Comments
[@gavinking] 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. |
[@gavinking] @tombentley Don't worry, I'm on top of that ;-) |
[@oehme] 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:
|
[@gavinking] So shall I reserve |
[@RossTate] Given that |
[@quintesse] Although |
[@oehme] I would be fine with "given", too. |
[@gavinking] I very weakly incline toward
But honestly I could go either way. |
[@lucaswerkmeister] 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 #3483? I’ve skimmed through the conversation, but it seems you discussed a whole lot of other things there as well that’s mostly unrelated… |
[@gavinking] I have implemented |
[@FroMage] So what's the syntax? I suppose it's a |
[@quintesse] 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. |
[@quintesse] Ok, so it's something like |
[@FroMage] Why, is it allowed to have no bindings? What's the use-case? |
[@quintesse] Sorry @FroMage , my mistake, it's actually: |
Of course not. |
[@FroMage] OK, thanks. |
[@FroMage] Should I do this one for the JVM then? |
[@quintesse] Ok, with me, I'm not going very fast at the moment with my current issue :/ |
[@tombentley] Go on then, I'll let you have this one. |
[@FroMage] Haha. |
[@FroMage] Done on the JVM in the |
[@chochos] Done on JS in the |
In fact this is not currently working. |
[@gavinking] @chochos Fixed, I think. |
[@chochos] 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. |
[@gavinking] Branched merged. Done! |
[@gavinking] Oh, wait, still need a spec! |
[@gavinking] 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 (#3853), 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
[@gavinking] 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 #3483 and #3850. 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 #3609, since you could write stuff like this:I think we should make this one a priority for 1.1.
[Migrated from ceylon/ceylon-spec#747]
[Closed at 2014-11-25 21:22:17]
The text was updated successfully, but these errors were encountered: