John Barton wrote:
offline Mark lured me in to making more suggestions. I bit:
p1 >< foo(a,b); // p1 "eventually when the sand runs out" foo(a,b);
p1 <> foo(a,b); // Because a wikipedia page has diamond for temporal
logic 'eventually'.
I guess angle brackets in general are trouble however, I recall some
issues with <html> and JS.
Probably best to avoid <>, although in HTML, only </ followed by certain
letters would be a problem ;-).
// Non-uniform tokens, maybe "modified tokens", where | isn't an
operator but is part of new tokens:
p1|.foo(a,b); // can't we have bar dot ?
p1|['foo'](a,b); // Here we have |[ ... ]
p1.foo|(a,b); // I'm just substituting | for ! in the examples in [0].
p1~.foo(a,b); // not 'now'
p1~['foo'](a,b); // Here we have ~[ ... ]
p1.foo~(a,b); // I'm just subst ~ for ! in the [0] examples.
Yes, ~ and | have meanings, but ! is so so much more common.
I want to point out this example of http://sweetjs.org/ -- a sweet.js
macro for let async:
https://gist.github.com/disnet/7934003 (contents below)
Sweet.js has come a long way. This makes me wonder just how much
built-in async syntax we need to hardcode into ES7.
/be
-----
let let = macro {
rule { async $vars ... = $fname ... ($params ...); $rest ...} => {
$fname ... ($params ..., function (err, $vars ...) {
if (err) throw err;
$rest ...
})
}
}
var buffer = new Buffer(1024);
let async infile = fs.open("/tmp/in.txt");
let async outfile = fs.open("/tmp/out.txt");
let async bytesRead, buffer = fs.read(infile, buffer, 0, 1024, 0);
let async bytesWritten, buffer = fs.write(outfile, buffer, 0, 1024, 0);
console.log("We read " + bytesRead + " bytes and wrote " + bytesWritten
+ " bytes.");
// compiles to:
var buffer$188 = new Buffer(1024);
fs.open('/tmp/in.txt', function (err$190, infile$191) {
if (err$190)
throw err$190;
fs.open('/tmp/out.txt', function (err$193, outfile$194) {
if (err$193)
throw err$193;
fs.read(infile$191, buffer$188, 0, 1024, 0, function (err$196,
bytesRead$197, buffer$188) {
if (err$196)
throw err$196;
fs.write(outfile$194, buffer$188, 0, 1024, 0, function (err$200,
bytesWritten$201, buffer$188) {
if (err$200)
throw err$200;
console.log('We read ' + bytesRead$197 + ' bytes and wrote ' +
bytesWritten$201 + ' bytes.');
});
});
});
});
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss