Jonathan Graveline pushed to branch graveline at Stefan / Typer
Commits: 5c4ba829 by Jonathan Graveline at 2018-07-31T22:47:13Z Add function syntax support in `plain-let`
- - - - -
1 changed file:
- btl/plain-let.typer
Changes:
===================================== btl/plain-let.typer ===================================== @@ -3,6 +3,9 @@ %%%% %%%% normal `let` but not recursive nor sequential %%%% +%%%% (currently handle definition with `_=_`) +%%%% (would declaration be useful ? (e.g. `_:_`)) +%%%%
%% List_nth = list.nth; %% List_fold2 = list.fold2; @@ -20,10 +23,19 @@ impl args = let gen-sym arg = let
io-serr = lambda _ -> IO_return Sexp_error; + + rename : Sexp -> IO Sexp; + rename sexp = Sexp_dispatch sexp + (lambda _ ss -> do { + name <- gensym (); + IO_return (Sexp_node name ss); + }) + (lambda _ -> gensym ()) + io-serr io-serr io-serr io-serr;
in Sexp_dispatch arg (lambda s ss -> if (Sexp_eq s (Sexp_symbol "_=_")) then - (gensym ()) else + (rename (List_nth 0 ss Sexp_error)) else (IO_return Sexp_error)) io-serr io-serr io-serr io-serr io-serr;
View it on GitLab: https://gitlab.com/monnier/typer/commit/5c4ba82976eced85b5bc2dc5f645babb986c...
Afficher les réponses par date
Add function syntax support in `plain-let`
Not sure we want to go down that route (next comes `define-operator`, then declaration macros, ...).
I think plain-let is only really useful for machine-generated code (typically macros), so we might as well keep it simple.
+%%%% (currently handle definition with `_=_`) +%%%% (would declaration be useful ? (e.g. `_:_`))
Type declarations should never be needed, AFAIK.
Stefan