a value declaration should be able to name a scalar type
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript
- Ambito
- compilers
Direzione di ricerca
Nell’issue non sono indicati file o test. Inizia individuando i percorsi del parser e del type-checker per le dichiarazioni di valori, poi risolvi Q1–Q3 prima di scegliere la sintassi. Il lavoro è completo quando una dichiarazione scalare può essere analizzata, può essere referenziata come LogOffset e le semantiche di assegnazione, confronto e aritmetica sono coperte dai test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
tl;dr
-
A
valuedeclaration must have a braced body, so a scalar can't be given a domain name
value LogOffset: Integerfails to parse. The only way to say "this Integer is a log offset" is a plainIntegerfield with a descriptive field name — which puts the name on the field rather than on the type, so nothing carries it to the next use site. -
The one-field wrapper workaround asserts structure that isn't there
value LogOffset { offset: Integer }checks clean, but every use site reads through.offset, and the spec now claims LogOffset is a composite when it's a number. -
The language reference already offers this and it doesn't exist
The primitive types section tells the reader to use "value types or plainStringfields with descriptive names" for domain-specific string types. A value type needs at least one field, so that's a one-way choice dressed up as two. -
What
LogOffsetis needs settling before the syntax does
Transparent alias or a distinct type (Q1) decides what the checker does withoffset = 0and witha.offset - b.offset.
Context
The everyday case for naming a type descriptively is a scalar, not a record: LogOffset, EmailAddress, Path, Millis, TenantId. Each is an Integer or a String that means something specific, and the meaning is exactly what a spec reader needs to see at the point of use.
Allium's value keyword is the natural home for that, but it's shaped for structured data only — the language reference introduces value types as "structured data without identity", with TimeRange and Location as the examples. There's no declaration form for the unstructured case.
Came up writing a spec with several distinct Integer-typed quantities in play, where offset: Integer and count: Integer sitting next to each other tell the reader nothing about which values are comparable with which — and there's no declaration form that can.
Current state
value requires a {:
-- allium: 3
value LogOffset: Integer
entity Log {
offset: LogOffset
}
error t.allium:3:16 expected '{', found ':'
error t.allium:6:13 allium.type.undefinedReference
Type reference 'LogOffset' is not declared locally or imported.
(allium 3.5.3)
The wrapper workaround passes, at the cost of a field the domain doesn't have:
value LogOffset {
offset: Integer
}
entity Log {
latest: LogOffset
is_empty: latest.offset = 0 -- .offset is pure ceremony
}
Open questions
-
Q1 — is a scalar value a transparent alias for its underlying type, or a distinct type?
Nominal is what makes the feature worth having: ifLogOffsetandMessageCountare both justInteger, the checker can't tell you you've compared one to the other, which was the point. But nominal has to answer what happens to arithmetic and comparison — whetherLogOffset - LogOffsetyields aLogOffset, anInteger, or an error, and whether the literal0is assignable to aLogOffsetfield. -
Q2 — which type expressions are allowed on the right?
Just the primitives (value Millis: Integer), or the full field type grammar including compounds and optionals (value Offsets: List<Integer>,value MaybeName: String?). -
Q3 — can a scalar value carry derived values or invariants?
A braced value type hangs them off its fields; a scalar has no field to name. Ifvalue Percentage: Decimalwants to constrain itself to 0..100, there's no established place to write it.
- Lingua principale
- JavaScript
- Stelle
- 538
- Fork
- 29
- Merge medio
- 4g 3h
- PR unite (30g)
- 5
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di juxt/allium
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 55/100
-
language suggestion
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
vercel-labs/ui#999 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
gcivil-nyu-org/team5-mon-fall26#152 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
router-for-me/models#105 ·
I maintainer di solito rispondono entro 1 giorno
-
[Prisma 8] Type-check time grows exponentially with chained .include() callsForse già presa @SiKreuz l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
prisma/orm#31161 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno