Comments (7)
We don't have a way to do this right now, and enabling it in a Roblox environment is unlikely to be feasible in the near future - the type solver and the bytecode compiler have different performance requirements, and enabling RTTI on all platforms (including clients that didn't actually compile the bytecode they're running) is a pretty complex problem.
Can I ask what you're wanting this information for? If it's for debugging purposes, there may be a less general way to solve this.
from luau.
I want the information so that I could generate a type
for the function so that tools like luau-lsp (or the luau type checker) can prevent me from breaking the api that my module allready defines (so I would write a function that takes a table and returns the type string)
from luau.
I'm not sure what is being asked here... is it a runtime function? Is it an editor feature that adds explicit annotations to existing code? E.g. we already have an --annotate
mode in luau-analyze, is that the ask?
from luau.
huh --annotate
exist but is not as good as luau-lsp type infrence? but I was told luau-lsp used functions avaliable in luau
also it appears to contradict it's self when you luau-analyze
a file that requires anything which has a table in it (it generates the type infrence, and places it somewhere. but does not fill out the table since it is doing like local module_type: {a:number} = {}
which then fails as module_type is still a table and is not being filled
from luau.
--annotate
is not as complete as it could be, because it's written as a debugging tool, not a "canonically annotate this type" tool. Its output is also, by necessity, going to generate errors like what you mentioned, because it applies the "final type" of a variable to the variable declaration, which creates issues when you're partially initializing the table.
luau-lsp likely provides better inference than --annotate
because it's working with Luau's C++ API, not the annotation syntax, and thus can handle types that we don't have syntax for, or unannotated types.
We've talked in the past about providing a way to generate an annotation that enforces the current inference results. I don't think it's coming in the next few months, but it is on our radar.
from luau.
I'm wondering if we need both this and #402 or if we can just keep one of these.
from luau.
i think that that issue is more about formatting (and not using pre-provided type-information)
my issue is more about the excessive use of any
and not properly detecting types
from luau.
Related Issues (20)
- Generic functions not being typed correctly in generalized iteration?
- Issue with type inheritance HOT 1
- Add io.read and io.write capabilities. HOT 5
- heap-use-after-free when running `luau-analyze` HOT 1
- luau 0.615 build failure HOT 5
- ??? it expected a socket, but it got socket, and luau is angry at me HOT 2
- Missing type label when using "&" in definition, even though type exists
- Missing newline character at the end of the REPL help message
- Nested tagged unions do not work as I want them to work HOT 1
- export type destroys free table state type syntax declaration HOT 3
- Autocomplete stops solving table.property because of "if table.property then return end", within a function body HOT 2
- Luau Debugger triggered, class-like table method HOT 2
- Luau Debugger Triggered, var name for function same as for table along with typeof HOT 4
- Luau crash with constraint debugger "x_as_any_if_x_is_instance_elseif_x_is_table" if x is used as a function HOT 4
- Add fully global functionality to Luau. (_G) HOT 1
- emscripten build failure HOT 3
- `LOADK` instruction right after `LOADKX` instead of an auxiliary parameter HOT 1
- Build fails with `LUAU_BUILD_CLI OFF` in 0.618 HOT 2
- Failed to link Luau after Clang build in Linux
- luau_load can't load this if I export the bytecode and manually put it inside Luau "ASSERTION FAILED: index < count"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from luau.