it greatly improves on it's predecessors
familiar syntax
it's designed to be practical, to the chagrin of CS purists
next-generation of applications being built (hadoop, palantir, runsecape : asana, meteor)
Is that suppose to be runescape, runescape or what?
Name:
Anonymous2012-09-09 9:32
The Achilles Heel of JavaScript is its inconsistent behavior across implementations. It is virtually impossible to use it to do anything robust on the client side.
JavaScript is weakly typed, and the automatic coercions that it does can produce surprising results. "2" + "3" is "23" (+, when applied to two strings, performs concatenation); "2" * "3" is 6. (Multiplication not defined for strings; so the language tries converting them to numerals, succeeds, and multiplies those). This can be surprising.
Rather annoying gotcha in array constructor. new Array() produces empty array; new Array(2,3) produces array with 2 and 3 as its elements. new Array(5) does not produce array with 5 as its single element; instead, it returns a 5-element array!
Whereas most languages have one universal singular value (null/nil/Void/whatever); JavaScript has three - "false", "null" and "undefined". That leads to confusing and irregular semantics.
No integral types - the only numeric type supported is an IEEE754 double-precision float. For a scripting language, this limitation is probably less obnoxious than it would be elsewhere.
Language has LexicalScoping, but with an interesting twist. Unlike JavaScripts brethen C/C++/Java/C#/etc, where variables introduced in an anonymous block within a function are only valid within that block; in JavaScript such variables are valid for the entire function.
Every script is executed in a single global namespace that is accessible in browsers with the window object.
Automatic type conversion between strings and numbers, combined with '+' overloaded to mean concatenation and addition. This creates very counterintuitive effects if you accidentally convert a number to a string:
var i = 1;
// some code
i = i + ""; // oops!
// some more code
i + 1; // evaluates to the String '11'
i - 1; // evaluates to the Number 0
The automatic type conversion of the + function also leads to the intuitive effect that += 1 is different then the ++ operator:
var j = "1";
j++; // j becomes 2
Symta:
point X Y = [X=X; Y=Y; add P = point X+P.X Y+P.Y]
JavaScript:
function point(X,Y)
{
this.X = X;
this.Y = Y;
this.add = function (P) { return point (this.X + P.X, this.Y + P.Y); }
}
Name:
replying to a pasta2012-09-09 10:06
>>3
>Rather annoying gotcha in array constructor.
Only PHP ``programmers'' call the constructor by its name, everybody else uses [].
>has LexicalScoping
and gets it right. u mad?
>Every script is executed in a single global namespace that is accessible in browsers with the window object.
Just wrong. Is that copied from c2, I thought they knew their Closures?
But yeah the type system is fucked up.
Name:
Anonymous2012-09-09 10:16
>>5 replying to a pasta
I bet you also has habit talking to bots. Is that because real girls ignore you, jerk-script faggot?
Name:
Anonymous2012-09-09 12:32
>verbose
>no operator overloading
>js jits use almost as much ram as jvm
>impressive in benchmarks and not so much outside of it
It is a web.scripting language that can't even multithread. Only idiots think node is good.
Name:
Anonymous2012-09-09 12:45
node.js? more like 'nad.jizz!
Name:
Anonymous2012-09-09 12:49
>>5
Lexical scoping in JS would be okay if there was a let statement so you wouldn't have to do
for (i = 0; i < N; i++) {
(function (item) {
add_event_handler(function () {
/* use item, can't use items[i] since i it contains a new value */
});
})(items[i]);
}
The distance between where the name item is introduced and the place it is assigned is not good.
Instead it should look something like this
for (i = 0; i < N; i++) {
let {
var item = items[i];
add_event_handler(function () {
/* item is a new lexically scoped name and is invisible outside of the let block */
});
}
}
Name:
Anonymous2012-09-09 12:54
>>10
you're just jelly your toy language doesn't have javascript-tier closures
>>3
thanks for extending my metaphor. java also had a ton of gotchas, but the underlying principles were a step above every language that came before it.
Shaw is the original writer of the Mongrel web server for Ruby web applications. Mongrel was the first web server used by Twitter, and inspired Node.js according to Ryan Dahl http://en.wikipedia.org/wiki/Zed_Shaw
// not beginning with, like ^ in regexps (use with pattern matcher)
m:nb X = \<&L = ne (lhd &L) $X>
// usage: foo X:of,«A B C» = say "X is one of the first three letters"
m:of Xs \= <&X = fnd &X $Xs>
sconc a b = conc a b | sym
filter f Xs = fold <A B = {f B = [@A It]; A}> [[]@Xs]
flat [@Xs] = mapc flat Xs; X=[X]
includes P [X:_:@!P @_]=X; P [_@Xs] = includes P Xs
rmap f [@Xs] = map (rmap f ?) Xs | f
;f X = f X
digits X = map num X,prn,str
//insert `sep` between elements of a list `l`
//Usage: infix "+" {a b c}
//Example: map ?,hex "LISP" | infix " " | fold sconc
//TODO: add flag to create (`+` A (`+` B C)) like lists
infix Sep L = fold [@? Sep ??] [(take 1 L) @L,ltl]
join S Xs = infix S Xs | fold conc
cut P S Xs = drop P Xs | take S
// mappend from CL
// Example: maps I=" " ?,hex str,"LISP"
mapc f Xs I:{ø} = map f !Xs = {I = infix I !Xs} = fold conc Xs
subst Src Dst L = map <!Src=Dst; X=X> L
// takeInit odd? [1 5 1 2 3 1 1 2 3] --> (1 5 1)
takeInit P [@Xs @(nb P)] = Xs // Take initial elements for which `p` is true
trim Xs S:{" "} I:{ø} L:{√} R:{√}
= Xs:Xs,str
X:{L && (pos (ne ? S) Xs) = It; 0}
Y:{R && ~(pos (ne ? S) Xs) = It; 0}
= {I = conc (take X Xs) (take Y Xs); drop Y (drop X Xs)} | sym
// break list into piles of `n` items
grp N [@Xs] = [(take N Xs) @(drop N Xs | grp N)]
// partition by `f`
part f Xs = R:ø = map <X=[@!R.(f X) X]> Xs = map ?,1 R
// Example1: unfold <1=ø; X=[X-1 1]> 7
// Example2: qsort Xs = Xs |
// unfold <[X] = X
// ;[X@Xs] = [(keep (lt ? X) Xs) [X] (keep (gt ? X) Xs)]>
unfold f O = f O | <ø=[O]; Xs = mapc (unfold f ?) Xs>
// counts the number of ones in the bit representation of an integer
// use it to calculate size of bitmasks
bitCount X = cl (logcount X)
// bit-length of an integer: 2^(log 2 ? | ceil)
bitLen X = cl (`integer-length` X)
// inverts `bits` bits in `value` (bitwise not)
inv Bits Value = cl (logxor (ash 1 Bits)-1 Value)
exp X = cl (exp X)
log Base X = cl (log X Base)
sin X = cl (sin X)
cos X = cl (cos X)
tan X = cl (tan X)
asin X = cl (asin X)
acos X = cl (acos X)
atan X = cl (atan X)
sum S = fold `+` [0@S]
prod S = fold `*` [1@S]
avg Xs = Xs,sum/Xs,len
dot Xs Ys = cl (`dot-lists` Xs Ys)
abs X = {num? X = cl abs X; cl (`dot-lists` X X) | sqrt}
norm V = V/V,abs
transpose V = N:0 = [V,lhd,len++(map <X = I:N = !N+1 = X,I> V)]
// convert list to set (an ordered list that does not have duplicated elements)
uniq L = L,sort,<[@A X X @B]=[@A @[X @B],r]; E=E>
// set operations
union A B = A,<[X@Xs] = {fnd X B = Xs,r ; [X@Xs,r]}; _=B>
isect A B = A,<[X@Xs] = {fnd X B = [X@Xs,r]; Xs,r}>
diff A B = union (skip (fnd ? B) A) (skip (fnd ? A) B)
ss [X@Xs] = R:{ss Xs; [ø]} [@R @(map [X @?] R)]
m:ldb Pos Size Value \= <P S V = (cl ldb (byte S P) V)> $Pos $Size $Value
maximize p [M@Xs]
= S:M,p = fe <X = NS:X,p = {NS > S = (M=X) = (S=NS)}> Xs = M
minimize p [M@Xs]
= S:M,p = fe <X = NS:X,p = {NS < S = (M=X) = (S=NS)}> Xs = M
m:while Test @Expr \= fc <= {$Test = $Expr = r}>
m:until Test @Expr \= while (n? $Test) $@Expr
m:loop Expr \= fc <:&r = $Expr = &r>
// Usage: times I:10 say i
m:times Head @Expr = C:Head,<[":" C N]=C; _=\&C>
N:Head,<[":" C N]=N; X=X >
\= &E:$N = 0,<:&r (&E) $C = $Expr = &r $C+1>
// for (I:0; I<6; !I+1) say I
m:for «$@V; $@C; $@I» @Body = \(= $@V = cl (while @$C @$Body $@(map \@$? I)))
;[":" $X $Xs] @Body \= fe <$X=$@Body> $Xs
// usage: gen X^2 for X:1..10 if X,odd?
// gen [X Y Z] for X:1..21 Y:X..21 Z:Y..21 if X^2 + Y^2 == Z^2
//m:gen @E \for @F \if @C
// \= &Xs:n try &Xs $@(map <[O A B]=[O A \(amb $B)]> F)
// {$@C = [@!&Xs $@E]}
// bt
// these will generate list of ascending/descending numbers
// FIXME: merge these into `..`
asc Start = seq Start (asc Start+1)
dsc Start = seq Start (dsc Start-1)
>>21,25
Ok then, any link to a spec, tutorial or anything? I honestly can't find anything on the internet on this "Symta", not even a blurb on wikipedia..
I honestly hate JS but Node.js is too damn easy to use to ignore it. Why isn't asynchronous programming easy to use in other languages as well?
Name:
Anonymous2012-09-10 11:14
>>32
I don't know Node.js but asynchronous programming is a misfeature in almost all cases because it obscures code even more than spaghetti and it actually has lower performance than proper synchronous programming.
Name:
Anonymous2012-09-10 11:35
>it actually has lower performance than proper synchronous programming.
Please provide some examples for that ludicrous claim.
Name:
332012-09-10 12:15
>>34
The mental and technical overhead of handling asynchronicity outweigh its advantages, since it has none. There really is no place for asynchronous callbacks outside of a hardware interrupt queueing events in a buffer and waking a thread up from select or similar.
Think about it and if you still think my claim is ludicrous afterwards, ask again for examples.
>>35
- node.js uses [code]select[code] to wait for network events
- network events are largely asynchronous
- networking is one of the project's primary intentions (http support is built-in)
Ergo your wrong bitch.
>>39
I'm afraid your anus is flawed. You can write async javascript even when the underlying network ballsack is ``synchronous I/O multiplexing''. Such is abstraction.
Name:
Anonymous2012-09-10 13:48
>>36 Ergo your wrong bitch.
No, it's my right bitch.
there are things that lua can do that javascript cannot, and places lua can fit in better than javascript would. It would be silly to use javascript for some of the applications that use lua for the same reason it would be silly to use lua for client side web scripting.
Javascript is good because it can run anywhere. We have no other choice for client-side web programming. So we learn to deal with its inconsistencies. Some learn to love it. But it's ultimately a bad language. You can't think about the future of the web and come to the conclusion that Javascript will still be there. Javascript is not suited for the web as an application platform. HTML5 tried to fix this--but it still relied on Javashit. Microshaft had the right idea with ActiveX. It was just too non-portable and difficult to use to have widespread adoption (although a lot of good browser-based software uses ActiveX because it just works).
The real problem with node.js is the assumption that we likes writing in Javascript. We use Javascript only out of necessity.
It has also picked up its own inertia in acceptance. Like how you will learn javascript if you are getting into web development, you will learn Lua if you are getting into video games or want to customize an application that offers lua scripting. In a way it is a standard customization language.
Name:
Anonymous2012-09-10 23:51
>>58
Now you understand the true meaning of the word "forced". And if you refuse, then some other shabbos-goyim will do the job - Earth is full of conformists, who will happily suck any Jewish dick and say "thank you, Shlomo".
>>60
Inferno, and thats it... the rest aren't likely good at all, after all they're still using ActiveX in 2012.
Considering that it has been severely limited to a legacy API solely to allow plug-in type things like Flash to work from IE7 onward, this might explain why IE6 is still around on corporate machines... to run some in-house shit written in VB.
Name:
Anonymous2012-09-11 7:09
async is fine. callback hell is entirely inherent to your ability as programmer, not to the merits of the platform. learn how to compose functions already faggots