-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
Make expression language compatible with Python #835
Labels
Comments
Related to #477 |
And #636 |
or maybe only dicts need to change? If newlines are significant, you can still write:
What about:
Same rule: newline or comma? Then you can omit commas too |
andychu
pushed a commit
that referenced
this issue
Oct 3, 2020
The div / mod / xor stuff wasn't worth it. We either match Python or C++. We don't invent our own. And it takes some potentially good variable names. Addresses #835.
4 tasks
Moved to #865 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
div
,mod
,xor
-- these should be punctuation. I guess//
is fine.**
for exponentiation%{name: val}
should be{name: val}
like JS{ }
for blocks as well and will use pgen2. I don't think so butwe'll see ... Core issue: Does tea have lexer modes? I think it needs some kind of contextual keywords and that's it? for
override
andinit
and stuff like that?|x| { f(x); f(y) }
? Maybe not in the Tea language?^(...)
in expression mode (inconsistent with comand mode{ }
, but that's OK)True
/False
/None
for porting, but reallytrue
/false
/null
is better (only types should be capital)Syntactic changes:
1,
isn't allowed, it'stup(1)
?++
is preferred for concatenation of strings, lists (and maybe dicts), but+
is also acceptedSemantic changes
??
operator that is likeor
, except it returns the first argument if it's non-null (None
), not iflen(x) == 0
. This matches C semantics.in
on lists (fixed too many accidentally quadratic bugs). It good for dicts, and maybe acceptable for strings ...Note on enhancements:
%(bare words)
d->key
as a shortcut ford['key']
Func[Int, Str => Int]
instead ofFunc[[Int, Str], Int]
push!(x)
andeven?(i)
100 MiB
-- (is that just a function calledsuffix_MiB
?)r'foo'
, maybe we wanthtml'foo'
orhtml"foo"
,sql'foo'
New functionality:
=>
for method call, universal function call on first arg type%mykey
. Parsed but not implemented. So equality is fast.x ~== y
operator that does type conversion (and also for floats maybe)\u{123456}
-- in C-style string literals, and stand alone!#'a'
and#'\n'
and\n
-- these evaluate to integers~ !~
for regex/eggex,~~ !~~
for glob patterns(x ~ g'*.py')
vs(x ~~ '*.py')
dot
<=>?
anddot*
<=>*
-- is there a way to reconcile these? Or it's actually[^/]*
~~
should NOT respect extended globs. Eggexes/regexes are preferred.&+
and&*
-- language semantics shouldn't depend on the compiler #824func(x Int) Int { var x = 3; set x = 5; return x+1 }
Lexer issues:
()
and[]
omit newlines like Python{}
doesn't, needs something more clever. Optional newlines are in the grammar, I thinkThe text was updated successfully, but these errors were encountered: