For all those jQuery fanboys

  • Thread starter Michael Haufe (\TNO\)
  • Start date
G

Garrett Smith

Douglas Crockford is a good speaker. Some of the things in his book are
clearly wrong. The lint tool has way too much subjectivity baked in,
reporting errors for perfectly valid EcmaScript programs, and still
calls FunctionDeclaration a function statement.
I don't think Crockford was or is as involved with YUI! as you think.
From what I understand his role was as a resource to the YUI! team.

Crockford's legacy is that he used good taste to choose good ideas
from how Scheme is used (lexical closures for message passing OOP and
s-expressions for data transport in the form of JSON), ideas discussed
on comp.lang.javascript, some of his own ideas about how to fit those
ideas together, and spread those ideas. He is a teacher and as a
teacher he has improved the overall quality of JavaScript programming
on the web.

In his presentations, Crockford has explained some closure patterns. I
have seen first hand really bad usage of the patterns that made the code
worse than it would hvae been otherwise, and the developers directly
attributed the usage to Crockford advice. So the patterns themselves are
not bad or good; they're patterns.

I guess it is easier to show the mechanics of how a closure pattern
works than is to show what not to do with that pattern.
And he killed ES4 which seems to have been the right choice.

I do not know if the factual part of that statement is correct.

I know that Crockford opposed ES4, but I do not know if he actually
killed it.
 
T

Thomas 'PointedEars' Lahn

Garrett said:
Peter said:
And [Douglas Crockford] killed ES4 which seems to have been the right
choice.

I do not know if the factual part of that statement is correct.

I know that Crockford opposed ES4, but I do not know if he actually
killed it.

I sure don't hope so. The development of ES4 fell into the time when
Netscape was taken over by AOL/TW, which afterwards closed down the
Netscape browser division (only to rebuild it partially later), firing e.g.
Waldemar "Captain Abstraction" Horwat who maintained the Netscape proposal
for ES4 and JavaScript 2.0 until 2003 in the process.

And I think it is a pity that this effort was abandoned/could not be
revived in 2008 in favor of what we have now, a Specification which is
incompatible on several of its features that were introduced earlier,
so that ES3-based and ES5-based scripts cannot coexist (check Annex E of
ES5) without further ado.

ES4 could have been an interesting step on the desktop, providing the
software developer with a way to choose between the prototype-based and the
class-based, and the loosely-typed and the strictly-typed approach in *one*
language. It really is a pity that it only made it to JScript .NET and
ActionScript 2.0.


PointedEars
 
M

Michael Haufe (\TNO\)

Peter said:
And he killed ES4 which seems to have been the right choice.

Garrett said:
I do not know if the factual part of that statement is correct.
I know that Crockford opposed ES4, but I do not know if he actually
killed it.

No, ES4 primarily killed itself according to BE. After some major
components of ES4 were deemed unfit for the browser, the rest kind of
fell away as being syntactic sugar for simpler constructs:

https://mail.mozilla.org/pipermail/es-discuss/2008-August/003400.html
 
T

Thomas 'PointedEars' Lahn

Thomas said:
David said:
[...] I pasted it into the Web browser's address bar, which
AFAIK, should have worked.

Not without a parameter value to replace the `%s' :)

[Bookmarklets] can be written differently (and I have done so) so that
they use a default value or the user is prompted for the parameter. If
have found this one I have written to be particularly useful:

javascript:var%20s%20=%20%22%s%22.split(/\s+/),
%20topic%20=%20(s[1]%20?%20%22%20%22%20+%20s[1]%20:%20%22%22),
%20lang%20=%20(s[1]%20&&%20/^[a-z]
{2,3}$/.test(s[1])%20?%20((topic%20=%20%22%22),%20s[1])%20:%20%22de%22);
%20void(topic%20=%20(s[0]%20&&%20s[0]%20!=%20%22%25s%22%20?%20s[0].replace(/_+/g,
%20%22%20%22)%20:%20%22%22)%20+%20topic);
%20if%20(typeof%20(topic%20=%20window.prompt(%22Query%20to%20%22%20+%20lang%20+%20%22.wikipedia.org:
%20topic))%20==%20%22string%22)%20{%20window.location%20=%20%22http://%22%20+%20lang%20+%20%22.wikipedia.org/wiki/%22%20+%20encodeURIComponent(topic.replace(/(_)
{2,}/g,%20%22$1%22).replace(/\s+/g,%20%22_%22));%20}

In case anyone is still interested, here it is in unescaped form
(obfuscation was not intended in the first place, that was just how Mozilla
returned the code):

javascript:var s = "%s".split(/\s+/), topic = (s[1] ? " " + s[1] : ""),
lang = (s[1] && /^[a-z]{2,3}$/.test(s[1]) ? ((topic = ""), s[1]) : "de");
void(topic = (s[0] && s[0] != "%s" ? s[0].replace(/_+/g, " ") : "") +
topic); if (typeof (topic = window.prompt("Query to " + lang +
".wikipedia.org:", topic)) == "string") { window.location = "http://" +
lang + ".wikipedia.org/wiki/" + encodeURIComponent(topic.replace(/(_)
{2,}/g, "$1").replace(/\s+/g, "_")); }

It can probably be refined, e.g. to run in a local execution context, but
it worksforme :)


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,248
Latest member
MagdalenaB

Latest Threads

Top