From 3ca054b6b992e2233d763aabc5c938ee10d116a4 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 4 Jan 2023 18:37:14 -0400 Subject: Added simple machinery for aliasing of definitions. --- stdlib/source/library/lux.lux | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'stdlib/source/library/lux.lux') diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 763b1b25f..e6108721f 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -3292,7 +3292,7 @@ _ ... TODO: Figure out why this doesn't work: - ... (of meta#monad in token) + ... (meta#in token) (meta#in token)} token)))) @@ -5479,14 +5479,15 @@ (again &rest (property#with var_name expansion map))) {#End} - (of meta#monad #in (list#conjoint (list#each normal bodies)))))) + (meta#in (list#conjoint (list#each normal bodies)))))) {#None} (failure (..wrong_syntax_error (symbol ..with_expansions))))))) (def .public (same? reference sample) - (All (_ a) - (-> a a Bit)) + (All (_ of) + (-> of of + Bit)) (.is?# reference sample)) (def .public as_expected @@ -5878,5 +5879,22 @@ [Declaration] ) -(type .public F64 Frac) -(type .public Double Frac) +(def .public alias + (macro (_ tokens) + (when (parsed (andP (tupleP (manyP localP)) + symbolP) + tokens) + {#Some [alias/+ original]} + (meta#in (list#each (function (_ it) + (` (def .public (, (local$ it)) + (, (symbol$ original))))) + alias/+)) + + {#None} + (failure (..wrong_syntax_error (symbol ..alias)))))) + +(alias [F64 Double] + ..Frac) + +(alias [alias?] + ..same?) -- cgit v1.2.3