Skip to content
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

Lack of null #95

Open
liuhenry4428 opened this issue Apr 17, 2020 · 2 comments
Open

Lack of null #95

liuhenry4428 opened this issue Apr 17, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@liuhenry4428
Copy link
Collaborator

Gator does not have a null keyword, but it is required for TypeScript, such as in functions that take in null as a parameter.

Current workaround: declare void null, which itself is a bug because it does not make sense for a variable to have type void.

@liuhenry4428 liuhenry4428 added enhancement New feature or request invalid This doesn't seem right labels Apr 17, 2020
@Checkmate50 Checkmate50 removed the invalid This doesn't seem right label Apr 18, 2020
@Checkmate50
Copy link
Contributor

I think null is actually a useful construct to have since it shows up a lot in C++/TS programming. Thoughts on what type it should have (I think it should be AnyTyp: anything can be null, but it doesn't interact with anything)?

@sampsyo
Copy link
Contributor

sampsyo commented Apr 19, 2020

Null is famously the billion-dollar mistake, so I think it's worth being careful about whether/how to add it. In particular, I don't think it's necessarily the case that something that shows up pervasively in C++/TS necessarily needs to be represented in Gator.

As sort of a follow-up to #97 (comment), consider this: you don't have to write code exactly the same way in Gator as you do in C++ or TypeScript. Idioms that make perfect sense in "real" C++ might not need to be duplicated in Gator code that you intend to compile to C++. Instead, the philosophy could be that you write Gator code in an idiomatically Gatory style—then, the compiler takes care of implementing that code in a way that works in the target (GLSL or TypeScript or C++). If the generated code needs to use null (for example), then so be it. But the higher-level, geometrically-focused source code in Gator might not need to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants