| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Timestamp | Comments | Which would you prefer to use, A or B? | ||||||||||||||||||
2 | 5/31/2012 8:27:34 | B | |||||||||||||||||||
3 | 5/31/2012 8:28:03 | B provides a sweeter, nicely encapsulated syntax | B | ||||||||||||||||||
4 | 5/31/2012 8:28:36 | B | |||||||||||||||||||
5 | 5/31/2012 8:31:26 | so tite. | B | ||||||||||||||||||
6 | 5/31/2012 11:32:28 | Too much Syntax sugar. | A | ||||||||||||||||||
7 | 5/31/2012 11:32:35 | A | |||||||||||||||||||
8 | 5/31/2012 11:32:36 | In my eyes, first method is simpler | A | ||||||||||||||||||
9 | 5/31/2012 11:32:37 | While 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:43 | B | |||||||||||||||||||
11 | 5/31/2012 11:32:44 | A | |||||||||||||||||||
12 | 5/31/2012 11:32:47 | I'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:49 | A | |||||||||||||||||||
14 | 5/31/2012 11:32:56 | I would use commas instead of semicolons though | B | ||||||||||||||||||
15 | 5/31/2012 11:33:10 | A | |||||||||||||||||||
16 | 5/31/2012 11:33:16 | I 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:20 | sup, with() reincarnate? long time no see. | A | ||||||||||||||||||
18 | 5/31/2012 11:33:40 | how about object literal syntax instead? div.{ innerHTML: "oh... HAI!", style:{ color: "green", border: "1px solid blue" } }; | A | ||||||||||||||||||
19 | 5/31/2012 11:33:59 | Although 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:27 | B | |||||||||||||||||||
21 | 5/31/2012 11:34:28 | A | |||||||||||||||||||
22 | 5/31/2012 11:34:29 | B | |||||||||||||||||||
23 | 5/31/2012 11:34:31 | B | |||||||||||||||||||
24 | 5/31/2012 11:34:35 | A | |||||||||||||||||||
25 | 5/31/2012 11:34:48 | B | |||||||||||||||||||
26 | 5/31/2012 11:34:51 | B | |||||||||||||||||||
27 | 5/31/2012 11:34:53 | A | |||||||||||||||||||
28 | 5/31/2012 11:35:00 | I don't like Imaginary syntaxes I prefer use real syntaxes it works better | A | ||||||||||||||||||
29 | 5/31/2012 11:35:02 | B | |||||||||||||||||||
30 | 5/31/2012 11:35:04 | B | |||||||||||||||||||
31 | 5/31/2012 11:35:08 | B | |||||||||||||||||||
32 | 5/31/2012 11:35:08 | B | |||||||||||||||||||
33 | 5/31/2012 11:35:16 | A | |||||||||||||||||||
34 | 5/31/2012 11:35:20 | B | |||||||||||||||||||
35 | 5/31/2012 11:35:22 | A | |||||||||||||||||||
36 | 5/31/2012 11:35:32 | B | |||||||||||||||||||
37 | 5/31/2012 11:35:34 | A | |||||||||||||||||||
38 | 5/31/2012 11:35:36 | B | |||||||||||||||||||
39 | 5/31/2012 11:35:38 | B | |||||||||||||||||||
40 | 5/31/2012 11:35:42 | B | |||||||||||||||||||
41 | 5/31/2012 11:35:42 | B | |||||||||||||||||||
42 | 5/31/2012 11:35:48 | B | |||||||||||||||||||
43 | 5/31/2012 11:35:53 | B | |||||||||||||||||||
44 | 5/31/2012 11:36:14 | B | |||||||||||||||||||
45 | 5/31/2012 11:36:15 | Feels more CSS-like and less Java-like. | B | ||||||||||||||||||
46 | 5/31/2012 11:36:15 | B | |||||||||||||||||||
47 | 5/31/2012 11:36:22 | A | |||||||||||||||||||
48 | 5/31/2012 11:36:25 | A | |||||||||||||||||||
49 | 5/31/2012 11:36:27 | Both are easy to read. B seems more logical to write. | B | ||||||||||||||||||
50 | 5/31/2012 11:36:28 | I 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:33 | looks nicer, makes more sense | B | ||||||||||||||||||
52 | 5/31/2012 11:36:42 | B 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:48 | weird at first, but definitely preferred | B | ||||||||||||||||||
54 | 5/31/2012 11:36:51 | B | |||||||||||||||||||
55 | 5/31/2012 11:36:55 | B | |||||||||||||||||||
56 | 5/31/2012 11:36:56 | <3 | B | ||||||||||||||||||
57 | 5/31/2012 11:37:01 | B | |||||||||||||||||||
58 | 5/31/2012 11:37:06 | B looks a little weird, but I think that is the best option. | B | ||||||||||||||||||
59 | 5/31/2012 11:37:06 | B | |||||||||||||||||||
60 | 5/31/2012 11:37:10 | Okay until i didn't see this i use to do it the A way | B | ||||||||||||||||||
61 | 5/31/2012 11:37:11 | B | |||||||||||||||||||
62 | 5/31/2012 11:37:13 | Can'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:13 | B | |||||||||||||||||||
64 | 5/31/2012 11:37:17 | B | |||||||||||||||||||
65 | 5/31/2012 11:37:22 | B | |||||||||||||||||||
66 | 5/31/2012 11:37:23 | B | |||||||||||||||||||
67 | 5/31/2012 11:37:26 | NICE!!! | B | ||||||||||||||||||
68 | 5/31/2012 11:37:27 | A | |||||||||||||||||||
69 | 5/31/2012 11:37:41 | that's cool :D | B | ||||||||||||||||||
70 | 5/31/2012 11:37:45 | B | |||||||||||||||||||
71 | 5/31/2012 11:37:53 | here's hoping ecma actually does this | B | ||||||||||||||||||
72 | 5/31/2012 11:37:55 | B | |||||||||||||||||||
73 | 5/31/2012 11:37:58 | Instead of using "=", how about using ":" Like this: style.{ color: "green"; border: "1px solid blue"; } | B | ||||||||||||||||||
74 | 5/31/2012 11:38:00 | B | |||||||||||||||||||
75 | 5/31/2012 11:38:02 | B | |||||||||||||||||||
76 | 5/31/2012 11:38:07 | Not bad but my gut feeling tells me it should be something like div.addProperty { } | B | ||||||||||||||||||
77 | 5/31/2012 11:38:09 | B | |||||||||||||||||||
78 | 5/31/2012 11:38:11 | The 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:12 | B | |||||||||||||||||||
80 | 5/31/2012 11:38:17 | B | |||||||||||||||||||
81 | 5/31/2012 11:38:19 | B | |||||||||||||||||||
82 | 5/31/2012 11:38:26 | B | |||||||||||||||||||
83 | 5/31/2012 11:38:36 | Nesting 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:53 | A | |||||||||||||||||||
85 | 5/31/2012 11:38:56 | B | |||||||||||||||||||
86 | 5/31/2012 11:39:21 | A | |||||||||||||||||||
87 | 5/31/2012 11:39:28 | win for encapsulation! | B | ||||||||||||||||||
88 | 5/31/2012 11:39:41 | Second 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:52 | This makes the code seem more organized | B | ||||||||||||||||||
91 | 5/31/2012 11:39:53 | I like the ideas that are proposed in Example B although I don't like the syntax. | A | ||||||||||||||||||
92 | 5/31/2012 11:40:00 | A | |||||||||||||||||||
93 | 5/31/2012 11:40:05 | Can i try that somewhere???? | B | ||||||||||||||||||
94 | 5/31/2012 11:40:24 | A | |||||||||||||||||||
95 | 5/31/2012 11:40:27 | If 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:48 | A | |||||||||||||||||||
97 | 5/31/2012 11:41:05 | monocle 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.next | B | ||||||||||||||||||
98 | 5/31/2012 11:41:06 | The 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:07 | A | |||||||||||||||||||
100 | 5/31/2012 11:41:08 | A |