julia-script / julia-script/silk
type-system: Add T? sugar for Option<T>
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 48
- Forks
- 0
- Avg merge
- 4h 49m
- Merged PRs (30d)
- 213
Description
Status
T? is not part of the first stable Silk language. Stable source imports and writes
Option<T> explicitly. This issue tracks post-stable syntax sugar for the same ordinary nominal
type; it must not introduce a privileged optional type.
Proposed surface
import silk.option { Option }
fn findUser(id: i32) -> User? {
// ...
}
Within this module, User? denotes the same type as Option<User>.
Required behavior
Optionmust resolve through ordinary lexical scope. Source must import it or declare another
visible binding according to the normal name-resolution rules.- Unknown, ambiguous, private, or shadowed
Optionbindings receive the ordinary diagnostics. - The compiler must not recognize
silk.optionor any standard-library declaration by spelling. T?andOption<T>are the same semantic type after resolution and have identical ownership,
layout, MIR, and backend behavior.- The formatter preserves the source spelling rather than rewriting one form into the other.
- Hover, completion, navigation, and documentation may explain the resolved
Option<T>identity
while retaining the writtenT?span.
Examples
Valid when Option is in scope:
import silk.option { Option }
fn absent() -> i32? {
return Option.none<i32>()
}
Invalid when no Option binding resolves:
fn absent() -> i32? {
return 0
}
The second program must report the ordinary unresolved-type dependency rather than silently loading
the standard library.
Out of scope
- Null values or nullability.
- Optional chaining and null-coalescing operators.
- Compiler privilege for the standard library.
- Changing the representation of
Option<T>.
Acceptance criteria
-
T?resolves to the same semantic type as an in-scopeOption<T>. - Missing, ambiguous, private, and shadowed bindings use ordinary resolution diagnostics.
- Formatter and LSP presentation preserve the authored sugar.
- Ownership, layout, MIR, evaluator, native LLVM, and direct Wasm match explicit
Option<T>. - No compiler phase recognizes a standard-library declaration by spelling.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by tracing type parsing and ordinary name resolution, then follow explicit Option through ownership, layout, MIR, evaluator, LLVM, Wasm, formatter, and LSP handling. Done means T? matches explicit Option without spelling-based standard-library treatment, while authored syntax and ordinary diagnostics are preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100