Need a JQuery plugin for D

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Tue May 12 09:48:55 PDT 2015


On Tue, May 12, 2015 at 08:54:01AM -0700, Walter Bright via Digitalmars-d wrote:
> https://i.stack.imgur.com/ssRUr.gif

Unfortunately, I think that requires D language extensions, because
currently module-level operator overloading isn't possible, which would
mean that it's impossible to overload the built-in integer addition
operator with a jQuery integer addition function. Not overloading
integer addition would be bad, because that's just yet another evil bad
design inherited from C++, and if we're gonna implement std.jquery, we
had better do it right and overload all built-in operators on all
built-in types.

And of course, the new integer addition function must use template
metaprogramming and ranges, because that's where we want D to go right
now, so we must also make module-level template operator overloading
possible, and make mockup integer types for input / forward /
bidirectional / random access ranges for adequate unittest coverage.
There should also be ddoc comments thoroughly explaining all possible
cases of integer addition along with their expected results. This should
be reinforced by appropriate in/out contracts, too, which means we'll
have to dig up that ugly old thread about why the current DbC
implementation in D is flawed.

All in all, I think this is a good direction to go in, but it may
require too many language changes, which Walter probably wouldn't
approve since it destabilizes the language. Perhaps there's a way to do
it as a library extension using version(), static-if blocks, and arcane
metaprogramming tricks involving __traits and CTFE. But Andrei and the
other core devs is too busy to be working on low-level stuff like this,
so where are those invisible champions who will push the PR through to
completion? C'mon, people, stop writing essays on the forum, and get
back onto GitHub; be the change that you wish to see happen!


T

-- 
There are four kinds of lies: lies, damn lies, and statistics.


More information about the Digitalmars-d mailing list