google / google/codeworld

Main-by-hash

Aperta
#1,296 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Haskell
Stelle
1.3k
Fork
201
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Per discussion with @alphalambda

In the spirit of import-by-hash (#1195) and prelude-by-hash (#1245), it would be interesting to define main-by-hash. In this mode, the compiler would pass a `--main-is` option to GHC that points to something else besides the student code (which is in module `Main`). That something else could import `Main`, but define its own entry point that calls the student code.

There's one problem: if student code lacks a module header (as it usually does), then GHC interprets this to mean only export the `main` (or `program` in codeworld mode) symbol. So naively, student code would need to have a module header, and that's a heavy enough impediment to sink the feature.

Option 1: Convince GHC to add an option to change the interpretation of missing module headers. It would be an easy change, but maybe not easy to convince GHC developers of the importance.

Option 2: Rewrite student code to have an explicit module header. Rewriting student code has never been done before, though, because it makes it hard to match error messages in the compiled code to the correct location in the input.

For now, this is a low priority.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia leggendo le issue correlate import-by-hash (#1195) e prelude-by-hash (#1245), quindi analizza il comportamento di --main-is di GHC per il codice degli studenti senza un’intestazione di modulo. Il lavoro sarà considerato completato quando sarà stato scelto un approccio che supporti un punto di ingresso separato preservando al contempo le posizioni accurate degli errori nel codice sorgente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
haskell
Ambito
compilers
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.