On Thu, Jan 12, 2012 at 08:17:06PM +0100, Marc Weber wrote:
> I don't want to offend anybody. Just trying to understand whether
> having JS support would change anything. So please consider this thread
> as being a test whether such a change would pay off in the long run for
> the community.

I'm getting lost in this discussion.  Are we discussing the addition
of a JavaScript interface, or the wholesale replacement of VimL with
JavaScript?

Clearly there is a lot of push-back to the idea of replacing VimL with
another language.  Let me be so bold as to venture to explain why that
is.

There are two components to what we know of as VimL: Ex commands and
expressions (please correct me if I'm wrong about this).

Ex commands, being those instructions entered in normal mode with the
':' character, are what we each spend a good portion of our day using.
They are the bread-and-butter of our interaction with the editor, and
have been a part of Vi since the beginning.  Your .vimrc is a VimL
program which is mostly composed of Ex commands.

Some Ex commands can introduce expressions, which is another language
entirely.  Ex commands do not deal with variables (with the exception
of Vim's settings, of course) nor data structures like lists or
dictionaries.  Ex has commands, not functions.

Vim doesn't *need* the expression language; in fact, expressions can
be excluded from Vim at compile-time (check whether you have the
"eval" feature).  The expression language, however, *needs* Ex
commands, as expression evaluation depends upon a handful of Ex
commands (see expression-commands and no-eval-feature).

Ex pre-dates Vi.  You can't get rid of Ex commands without
fundamentally changing the Vi-ness of Vim.  I am therefore confident
in my view that the Ex commands portion of VimL is never going away.

It seems to me that Vim's expression language is the only language up
for debate.  When people say things like "VimL sucks, let's use
$LANGUAGE_DU_JOUR instead!", it only makes sense to understand it in
terms of replacing the expression language.

Let me offer my opinion that nobody will try to prevent the *addition*
of JavaScript support via an interface; indeed, Vim already
accommodates mzscheme, perl, python, python3, ruby, and tcl.  Another
one won't hurt.  So the question becomes, "on what grounds can we
oppose the replacement of the expression language"?

VimL is a domain-specific language in that it is tailored to the
runtime environment inside a text editor.

JavaScript is a domain-specific language in that it is tailored to the
runtime environment inside a web browser.

The reason that there is such strong opposition to the JavaScript idea
is that some are advocating the replacement of VimL with a different
domain-specific language.  From a wholly different domain.

JavaScript is just a DSL from a domain that happens to be bigger.
That's its only real advantage over VimL's expressions.

Discounting all of JavaScript's warts and unsavory parts, JavaScript
proponents still have to answer this question: why is the DSL of a web
browser superior to the DSL of a text editor?

JavaScript was created by a web browser company to be used within
their web browsers.  Think about it: before the advent of Node.js,
would anybody take you seriously if you suggested using JavaScript
outside a web browser?  And even then, Node.js was created to work
inside of a *web server*.

Look, I understand that the DOM interface isn't technically a part of
the language, and that's great because a DOM makes zero sense in a
text editor.  But JavaScript is a web language.  I don't care what
www.CommonJS.org says, the only people who care about JavaScript are
web developers and browser plugin authors.  Vim users may also be web
browser users, but that doesn't make us web devs.

This is why there is so much resistance to the notion of replacing
VimL with JavaScript.

Vim is a multi-cultural text editor.  Hackers across all of the great
digital traditions use it.  Choosing one language from among all of
the languages would imbue Vim with the stink of favoritism which would
fracture the community.

If the expression language were changed to Perl, you'd piss off all of
the Python and Ruby people.  If it were Ruby, you'd piss off the
Pythonistas and Perlers.  If it were changed to Scheme, it would be
super-powerful and concise but the comparisons to EMACS would be too
much to bear.  If you switched it to BASIC, then the only people who
would still /want/ to use Vim would probably just stick with
notepad.exe anyway.  Making JavaScript the expression language de jure
would no doubt delight a small (but beloved :) minority of Vim users
to the disgruntlement of the rest.

I'm not saying that fear of fragmenting the community is the *best*
reason to leave the expression language alone, but it is something
that must be overcome.

At the end of the day, a truly general-purpose language has a better
shot at overthrowing VimL's expressions than a web browser's DSL.
Even so, a general-purpose language will come with many superfluous
features which don't help the task of editing text.  And the
general-purpose replacement will need to overcome its lack of VimL's
built-in text editing functions.


-- 
Erik Falor
Registered Linux User #445632 http://linuxcounter.net

Attachment: pgpt6NY0OnpbB.pgp
Description: PGP signature

Reply via email to