Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@Jumpshot44 hehe! He fired me, when I explained him the concept of application architecture. :D
-
ac123511478yAs an organisation leader I try force people to use one-line solutions, but I code on my own and do one-liners then too, so I guess its OK
-
@ac1235 I disagree, a one liner is simply not always an option, and even when it is it can be super unclear. In that case it's simply a better idea to spread it out over multiple lines.
-
ac123511478y@LucaScorpion If you cant express ideas shortly perhaps you just dont understand them.
If it is built of multiple algorithms, split it up into multiple functions, but just use 1 line per function -
@ac1235 Really? A single line per function? See I only program js as a hobby but that sounds ridiculous to me, as the whole point of functions is to group multiple instructions.
-
ac123511478y@LucaScorpion In JavaScript you can write things like:
function(x){return y}
as:
(x) => y
which makes it easy to write one-liners -
@ac1235 Yeah I know that, but that doesn't make the one line per function idea more logical to me. If it's only a single line,why even have a function for it?
-
ac123511478y@LucaScorpion
To name things properly:
greeting = (name) => "Hello " + name;
greet = (name) => console.log(greeting(name));
getName = () => prompt("Name:");
greet(getName()); -
@ac1235 Yes, but those are extremely simple functions, and I probably wouldn't even create functions for that. I'd like to see you create a function for a more complex algorithm with just one liners :P
-
@ac1235 404 on the link
I am personally a fan of functional paradigm. Rather than one-lineres, well thought solutions are what makes thr code shorter and easier to understand. You can usually achieve the same outcomes with map/filter/reduce/currying. These are just what are available in js which was not intended to be a fp lang. If you get pattern matching and strong type system, that would be even better.
Elm lang and purescript would allow you to write shorter, safer and easier understand client side code. -
ac123511478y@rusty-hacker
Imagine this in ES7:
function sum([]) {
return 0;
} else ([x:xs]) {
return x+sum(xs);
}
But to make this work, they first have to make "[1,2,3] === [1,2,3]" work :D -
@ac1235 I personally prefer to write code as generic as possible, sometimes that means using one-liners, sometimes not, but is always good to keep readability in mind.
-
ac123511478y@jpichardo still, javascript must support equaility tests, like [1,2,3] === [1,2,3] for me to use it
-
@ac1235 yeah, that's is something I don't like about js and some weak typed languages
-
ac123511478y@jpichardo well erlang and python do it right, perl too.
Its really not about the typing discipline, its just a design issue.
I know that they can not fix it to make it work with ===, since many websites would crash then, but they could add another operator, something like prologs =:=, so that:
[1,2,3] === [1,2,3] is false (ptr test)
[1,2,3] =:= [1,2,3] is true (content test) -
@ac1235 yeah, you can always add to the prototype, correct me if I'm wrong, but it's still extra code.
-
ac123511478y@jpichardo really js should do a complete redesign, just like a subset of the perl community did by inventing perl6;
a pragma like:
"use ecma7";
add the beginning of the code then could enable the features which break the behavior of == for example -
@ac1235 Sounds good maybe you can start with it, but you can always use a "compile to js" language, like typescript or coffeescript, or make a AntScript
-
@ac1235 To be honest not much, I read the readme and the GitHub.io site, it sounds interesting but I'm not much of a scientist myself, just math and stuff. However I did realized two things, that antlang is an array based language and that there is an spelling mistake in "when you are experienced enaugh"
-
ac123511478yI myself have nothing to do with science, too.
I'm just purely math and programming, too.
Just have to understand enough (not enaugh ;) ) to implement what they need.
My (soon to become ex -) boss thinks "Every problem has an one-liner Javascript solution, that he doesn't have time to write."
undefined
#boss