ABCDEFGHIJKLMNOPQRSTU
1
TimestampCommentsWhich would you prefer to use, A or B?
2
5/31/2012 8:27:34B
3
5/31/2012 8:28:03B provides a sweeter, nicely encapsulated syntaxB
4
5/31/2012 8:28:36B
5
5/31/2012 8:31:26so tite.B
6
5/31/2012 11:32:28Too much Syntax sugar.A
7
5/31/2012 11:32:35A
8
5/31/2012 11:32:36In my eyes, first method is simplerA
9
5/31/2012 11:32:37While I really like the idea, I feel that the options in B stray too far from standard JS syntax and would be very error prone.A
10
5/31/2012 11:32:43B
11
5/31/2012 11:32:44A
12
5/31/2012 11:32:47I'd rather not have a "." after style. I feel the object notation alone would be enough of a separation. Drop that and you'd have a sweet implementation.B
13
5/31/2012 11:32:49A
14
5/31/2012 11:32:56I would use commas instead of semicolons thoughB
15
5/31/2012 11:33:10A
16
5/31/2012 11:33:16I am curious what the semantics of the curly braces are in the assignment case: are they an expression that can be used for other purposes? I could see myself using syntax B to start, then wanting to log an intermediate value in the middle of setting the style, and having to desugar all the way back to the old syntax in order to be able to log what is going on.A
17
5/31/2012 11:33:20sup, with() reincarnate? long time no see.A
18
5/31/2012 11:33:40how about object literal syntax instead?

div.{
innerHTML: "oh... HAI!",
style:{
color: "green",
border: "1px solid blue"
}
};
A
19
5/31/2012 11:33:59Although I like the idea of the imaginary syntax, I'm not too sure if it's so great. While it does save some typing, it isn't significantly shorter, and the syntax seems a tad confusing. I would kind of assume this object-literal like syntax would use : instead of = or such as well.

Perhaps with some better way of expressing the same construct it might be a better idea.
A
20
5/31/2012 11:34:27B
21
5/31/2012 11:34:28A
22
5/31/2012 11:34:29B
23
5/31/2012 11:34:31B
24
5/31/2012 11:34:35A
25
5/31/2012 11:34:48B
26
5/31/2012 11:34:51B
27
5/31/2012 11:34:53A
28
5/31/2012 11:35:00I don't like Imaginary syntaxes I prefer use real syntaxes it works betterA
29
5/31/2012 11:35:02B
30
5/31/2012 11:35:04B
31
5/31/2012 11:35:08B
32
5/31/2012 11:35:08B
33
5/31/2012 11:35:16A
34
5/31/2012 11:35:20B
35
5/31/2012 11:35:22A
36
5/31/2012 11:35:32B
37
5/31/2012 11:35:34A
38
5/31/2012 11:35:36B
39
5/31/2012 11:35:38B
40
5/31/2012 11:35:42B
41
5/31/2012 11:35:42B
42
5/31/2012 11:35:48B
43
5/31/2012 11:35:53B
44
5/31/2012 11:36:14B
45
5/31/2012 11:36:15Feels more CSS-like and less Java-like.B
46
5/31/2012 11:36:15B
47
5/31/2012 11:36:22A
48
5/31/2012 11:36:25A
49
5/31/2012 11:36:27Both are easy to read. B seems more logical to write. B
50
5/31/2012 11:36:28I definitely agree with the concept of grouping style attributes into one object, but would probably prefer using JSON (assignment with ":") rather than variable assignment using '='. Definitely nitpicky, but any time you can group multiple like attributes into one element, it produces cleaner, more readable code. B
51
5/31/2012 11:36:33looks nicer, makes more sense

B
52
5/31/2012 11:36:42B looks like more encapsulated and easy to understand when things get complicated. A looks like it is more prone to get confusing when dealing with big code.B
53
5/31/2012 11:36:48weird at first, but definitely preferredB
54
5/31/2012 11:36:51B
55
5/31/2012 11:36:55B
56
5/31/2012 11:36:56<3B
57
5/31/2012 11:37:01B
58
5/31/2012 11:37:06B looks a little weird, but I think that is the best option.B
59
5/31/2012 11:37:06B
60
5/31/2012 11:37:10Okay until i didn't see this i use to do it the A way B
61
5/31/2012 11:37:11B
62
5/31/2012 11:37:13Can't you just use the with() function? I'm not much of a JS coder, but seems like the same thing. Nice idea anyhow :)B
63
5/31/2012 11:37:13B
64
5/31/2012 11:37:17B
65
5/31/2012 11:37:22B
66
5/31/2012 11:37:23B
67
5/31/2012 11:37:26NICE!!!B
68
5/31/2012 11:37:27A
69
5/31/2012 11:37:41that's cool :DB
70
5/31/2012 11:37:45B
71
5/31/2012 11:37:53here's hoping ecma actually does thisB
72
5/31/2012 11:37:55B
73
5/31/2012 11:37:58Instead of using "=", how about using ":" Like this:

style.{
color: "green";
border: "1px solid blue";
}
B
74
5/31/2012 11:38:00B
75
5/31/2012 11:38:02B
76
5/31/2012 11:38:07Not bad but my gut feeling tells me it should be something like div.addProperty {

}

B
77
5/31/2012 11:38:09B
78
5/31/2012 11:38:11The div.{} syntax is ulgy, if it were something like div({}) or div.dom({}) that would be an improvement.A
79
5/31/2012 11:38:12B
80
5/31/2012 11:38:17B
81
5/31/2012 11:38:19B
82
5/31/2012 11:38:26B
83
5/31/2012 11:38:36Nesting feels much more natural to javascript. I've never liked having do type div div div div over and over.

Ideally, I would prefer chaining. Though I suppose that's why I like jQuery so much...

// Append the new div to the body of the current document
document.body.appendChild(

// Create a new div element
document.createElement("div")

// Set the new div's display content
.html("oh... HAI!")

// Set the visual display style of the new div
.style({
color : "green",
border : "1px solid blue"
})

);

Jordan Hoff
@jhoff484
B
84
5/31/2012 11:38:53A
85
5/31/2012 11:38:56B
86
5/31/2012 11:39:21A
87
5/31/2012 11:39:28win for encapsulation!B
88
5/31/2012 11:39:41Second one is classier, i liked that usage.B
89
5/31/2012 11:39:45"B" is preferable; *however*, I'd prefer that the `=` operator be replaced with the standard object literal property syntax:

document.createElement("div").{
innerHTML: "oh... HAI!",
style.{
color: "green",
border: "1px solid blue"
}
}

I think this makes it easier to see that you're modifying object properties, rather than initializing variables (the current syntax is reminiscent of the `with` statement).
B
90
5/31/2012 11:39:52This makes the code seem more organizedB
91
5/31/2012 11:39:53I like the ideas that are proposed in Example B although I don't like the syntax.A
92
5/31/2012 11:40:00A
93
5/31/2012 11:40:05Can i try that somewhere????B
94
5/31/2012 11:40:24A
95
5/31/2012 11:40:27If all identifiers inside the property scope are limited to property names, then you could overcome the with-scope issue. Nice, love it!B
96
5/31/2012 11:40:48A
97
5/31/2012 11:41:05monocle mustache syntax could be great, much like css preprocessor nesting it helps me create a mental model faster, instead of scanning div.style.whatever and having to parse down for each line over and over again, even milliseconds, I know which context I'm in all the time. It's very understandable and something I would love to have in ES.nextB
98
5/31/2012 11:41:06The nested styles tend to get messy. Developers tend to treat them like loops and stuff everything within one pair of braces.A
99
5/31/2012 11:41:07A
100
5/31/2012 11:41:08A