a value declaration should be able to name a scalar type
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- javascript
- Área
- compilers
Línea de trabajo
En el issue no se menciona ningún archivo ni test. Empieza localizando las rutas del parser y del type-checker para las declaraciones de valores y, después, resuelve Q1–Q3 antes de elegir la sintaxis. El trabajo está terminado cuando una declaración escalar se puede parsear, se puede referenciar como LogOffset y sus semánticas de asignación, comparación y aritmética están cubiertas por tests.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- JavaScript
- Estrellas
- 538
- Forks
- 29
- Merge medio
- 4 d 3 h
- PR fusionados (30 d)
- 5
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de juxt/allium
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 55/100
-
language suggestion
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Todos los issues de juxt/allium
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
vercel-labs/ui#999 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
swc-project/swc-ai-issues#995 ·
-
[workshop-sim] Repair: Strengthen checkpoints and lock-file prerequisite in Agentic intro (Step 5)Abiertofeedback simulation workshop
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
githubnext/gh-aw-workshop#5973 ·
Los mantenedores suelen responder en 1 día
-
Development server fails with webpack-dev-server 6.1.0Posiblemente ocupada @utsxvrai la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
rabbitmq/rabbitmq-website#2733 ·
Los mantenedores suelen responder en 1 día