-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add commonjs export keyword #131
Conversation
@@ -11,7 +11,7 @@ Should dogescript be ported to other languages, the `js` portion may be changed | |||
|
|||
* dogescript uses single quotes for strings. Double quotes are not supported. | |||
* dogescript uses 4 space characters for indentation. Tabs are not supported. | |||
* dogescript seperates statements by newlines by default. In true-doge mode, they are separated by 3 spaces. | |||
* dogescript separates statements by newlines by default. In true-doge mode, they are separated by 3 spaces. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change seems irrelevant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed it's misspelled, I can revert it
lib/parser.js
Outdated
{ | ||
|
||
// woof foo is X | ||
if ( keys[2] === 'is') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the potential ambiguity between this and exporting an equality comparison a concern?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I battled with this internally. originally I was using the as
keyword like we do for require: so blah as blah
, but that sort of shifted everything around:
woof such f much b wow as bar
Can you export an ===
? :
module.exports = === b;
I kept is
since at least it feels consistent (though misleading) with very x is y
. I guess it's not really needed for the woof
statement. Would it feel too out of place to not have it?
woof bar such foo
vs
woof bar is such foo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe I misunderstood :( care to elaborate? @vpzomtrrfrt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I was referring to the possibility of module.exports = foo === bar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I don't think so, since at that point keys[4] would be the ===
marker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might have to make it a bit wonky:
woof as foo much a b
shh 1
wow
Since wow is a terminating keyword it might be tricky to try to support
woof much a b
ahh 1
wow as foo
Particularly with the available tokens being provided on a line basis, we won’t have the export name until we process the wow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might have to make it a bit wonky:
woof as foo much a b
shh 1
wow
Since wow is a terminating keyword it might be tricky to try to support
woof much a b
ahh 1
wow as foo
Particularly with the available tokens being provided on a line basis, we won’t have the export name until we process the wow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that's a good point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we used so
(feels odd but the woof keyword helps distinguish)
woof foo so much a b
shh 1
wow
module.exports.foo = function(a,b,) { //1 }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, other thanso
I also thought of be
woof foo be much a b wow
=> module.exports.foo = function (a,b)
Can’t think of any other keywords atm :(
@vpzomtrrfrt any outstanding issues with this? |
I'll push some changes with |
Pushed changes with |
@vpzomtrrfrt any opposition with the new keyword? |
|
@vpzomtrrfrt ready for final blessing :) |
Adds
woof
as a keyword formodule.exports