question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transpile property/method accesses that would be invalid Lua into bracket syntax

See original GitHub issue

Solve the promise:andThen and Symbol.for macros in a more generic way, instead changing reserved Lua keyword accesses into bracket literal syntax.

Symbol["for"] promise["then"](promise, ...) <-- need to do this special behavior for method syntax

Additionally when generating Lua from classes/otherwise, ensure that we do something like this:

t["then"] = function(self)
    
end

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:18 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
Validarkcommented, Nov 17, 2018

For Roblox-ts “built-in” names, I think all. For user created methods/variables/etc, just the keyword collisions. This could be more elegantly balanced if we carefully implemented Promise and perhaps the Run-time lib in TS.

1reaction
osyrisrblxcommented, Nov 16, 2018

Sure, we have precedent of doing something similar with generated variables elsewhere in the compiler (like _0)

But maybe allowing this is a bad idea to begin with: Classes created with TS that use reserved Lua keywords would lose the ability to inter-op with Lua effectively. But also, function calls can be expressions, so that could dramatically increase the complexity of compiled code.

For example, foo(returnsAPromise().then(() => {}))

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lua 5.3 Reference Manual
A metatable controls how an object behaves in arithmetic operations, bitwise operations, order comparisons, concatenation, length operation, ...
Read more >
Are curly brackets used in Lua? - Stack Overflow
Another place that curly braces appear is really the same semantic meaning, but it is concealed (for a new user of Lua) behind...
Read more >
DataS/week1-MultilabelClassification.ipynb at master - GitHub
In this assignment you will learn how to predict tags for posts from StackOverflow. To solve this task you will use multilabel classification...
Read more >
TS-runtime: Runtime Type Checks for TypeScript - Morioh
If runtime checks have to be inserted into an arrow function without a ... Only as number syntax for type assertions (no angle-bracket...
Read more >
series' objects are mutable, thus they cannot be hashed
NSArray, NSSet, NSOrderedSet, and NSDictionary Foundation's collection classes are the basic building blocks of every Mac/iOS application. In this article ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found