MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/shittyprogramming/comments/b5om5u/abusing_javascripts_syntax_yay/ejg5aer/
r/shittyprogramming • u/Droploris • Mar 26 '19
15 comments sorted by
View all comments
Show parent comment
3
That's unnecessarily complicated. Just define SET, GET etc as normal functions. Adding extra parenthesis to expressions doesn't change them so it's a valid call still.
5 u/AyrA_ch Mar 26 '19 But then you could no longer do the method chaining. This only works because all functions return the next function you need. 1 u/YRYGAV Mar 27 '19 Wouldn't semicolon insertion fix the issue anyways? 1 u/AyrA_ch Mar 27 '19 semicolon insertion is the problem which makes the lines look like individual instructions rather than a chain of them. 1 u/sim642 Mar 27 '19 There's no chaining then. Just multiple lines of code calling different functions, the most usual kind of code. 1 u/Droploris Mar 27 '19 isn't this subreddit about bad code?
5
But then you could no longer do the method chaining. This only works because all functions return the next function you need.
1 u/YRYGAV Mar 27 '19 Wouldn't semicolon insertion fix the issue anyways? 1 u/AyrA_ch Mar 27 '19 semicolon insertion is the problem which makes the lines look like individual instructions rather than a chain of them. 1 u/sim642 Mar 27 '19 There's no chaining then. Just multiple lines of code calling different functions, the most usual kind of code.
1
Wouldn't semicolon insertion fix the issue anyways?
1 u/AyrA_ch Mar 27 '19 semicolon insertion is the problem which makes the lines look like individual instructions rather than a chain of them.
semicolon insertion is the problem which makes the lines look like individual instructions rather than a chain of them.
There's no chaining then. Just multiple lines of code calling different functions, the most usual kind of code.
isn't this subreddit about bad code?
View all comments
Show parent comment
3
u/sim642 Mar 26 '19
That's unnecessarily complicated. Just define SET, GET etc as normal functions. Adding extra parenthesis to expressions doesn't change them so it's a valid call still.