Yet another layer to go through when debugging. Wonderful! /s
I don't know why you're being fight club ed, this is a serious concern. The places where this comes in handy are already prime candidates for bug hiding locations. Adding this in might remove some of those, but if the cost is that debugging what remains is significantly more difficult, then is it really worth it?
Show HN: ClarifyJs – Overcoming Limits of JavaScript Method Chaining
11–18 of 18 posts
Re: Show HN: ClarifyJs – Overcoming Limits of JavaScript Method Chaining
#12The example with the message could just be msg('hello everyone').to( list).except('John').send().then... where send() returns a promise. That is, the message creates an object that is getting modified until it hits the send method and then it is done. Maybe it is just a too simple example to get a point across, but I would want to see an example where this would not work.
> await msg('hello everyone').to( list).except('John')
Re: Show HN: ClarifyJs – Overcoming Limits of JavaScript Method Chaining
#13I think DSLs are, as their name says, domain specific. I do not think there's a one size fits all solution.
Re: Show HN: ClarifyJs – Overcoming Limits of JavaScript Method Chaining
#14Yet another layer to go through when debugging. Wonderful! /s
I don't know why you're being fight club ed, this is a serious concern. The places where this comes in handy are already prime candidates for bug hiding locations. Adding this in might remove some of those, but if the cost is that debugging what remains is significantly more difficult, then is it really worth it?
Re: Show HN: ClarifyJs – Overcoming Limits of JavaScript Method Chaining
#15The example with the message could just be msg('hello everyone').to( list).except('John').send().then... where send() returns a promise. That is, the message creates an object that is getting modified until it hits the send method and then it is done. Maybe it is just a too simple example to get a point across, but I would want to see an example where this would not work.
Re: Show HN: ClarifyJs – Overcoming Limits of JavaScript Method Chaining
#16How is this clearer than normal method calling, when you have to look for a priority number in the config to know which method executes before the other one?
Sorry but I think this is a really bad idea...
Re: Show HN: ClarifyJs – Overcoming Limits of JavaScript Method Chaining
#17The example with the message could just be msg('hello everyone').to( list).except('John').send().then... where send() returns a promise. That is, the message creates an object that is getting modified until it hits the send method and then it is done. Maybe it is just a too simple example to get a point across, but I would want to see an example where this would not work.
My impression is the goal of this library is to make it a little cleaner than the builder pattern because you don't need the `.send()` at the end. Arguably, it's nice to make the syntax a little more concise if the library is there to hide all of the complicated details from you. That said, I get uneasy when reading code like the example send('hello everyone!').to('friends').except('john'); since it doesn't follow my…
I guess otherwise it would need to be something like send('hello everyone').to('friends', 'John'); but now you don't understand what 'John' does unless you read the code - which,I know, realistically people don't always make their methods match the names so you don't really know that except('John') does what you might assume until you read it as well.
But in a theoretical world that was as we would like it to be you could reason from the method name to what the method actually does.
Re: Show HN: ClarifyJs – Overcoming Limits of JavaScript Method Chaining
#18Oof... syntactic sugar at the cost of obfuscation and configuration. How is this clearer than normal method calling, when you have to look for a priority number in the config to know which method executes before the other one? Sorry but I think this is a really bad idea...