aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/ffi.old.lux
diff options
context:
space:
mode:
authorEduardo Julian2022-06-12 00:38:20 -0400
committerEduardo Julian2022-06-12 00:38:20 -0400
commitb48ea68a83d01903554c7696c77eedaaf1035680 (patch)
treec342d8094c3158de16526f874ca9624418cd2dd2 /stdlib/source/library/lux/ffi.old.lux
parent7abf2d0ac55c229a8793bbff31f132596ffcb275 (diff)
De-sigil-ification: suffix : [Part 3]
Diffstat (limited to 'stdlib/source/library/lux/ffi.old.lux')
-rw-r--r--stdlib/source/library/lux/ffi.old.lux53
1 files changed, 29 insertions, 24 deletions
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index 8aa106b28..1e6d515dc 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -27,7 +27,7 @@
["[0]" template]]
["[0]" meta]]])
-(template [<name> <op> <from> <to>]
+(with_template [<name> <op> <from> <to>]
[(def: .public (<name> value)
(-> (Primitive <from>) (Primitive <to>))
(<op> value))]
@@ -63,12 +63,14 @@
[char_to_long "jvm convert char-to-long" "java.lang.Character" "java.lang.Long"]
)
-(template [<forward> <from> <to> <backward>]
- [(template: .public (<forward> it)
- [(|> it (.is <from>) (.as (Primitive <to>)))])
+(with_template [<forward> <from> <to> <backward>]
+ [(def: .public <forward>
+ (template (<forward> it)
+ [(|> it (.is <from>) (.as (Primitive <to>)))]))
- (template: .public (<backward> it)
- [(|> it (.is (Primitive <to>)) (.as <from>))])]
+ (def: .public <backward>
+ (template (<backward> it)
+ [(|> it (.is (Primitive <to>)) (.as <from>))]))]
[as_boolean .Bit "java.lang.Boolean" of_boolean]
[as_long .Int "java.lang.Long" of_long]
@@ -76,12 +78,14 @@
[as_string .Text "java.lang.String" of_string]
)
-(template [<forward> <from> <$> <mid> <$'> <to> <backward>]
- [(template: .public (<forward> it)
- [(|> it (.is <from>) (.as (Primitive <mid>)) <$> (.is (Primitive <to>)))])
+(with_template [<forward> <from> <$> <mid> <$'> <to> <backward>]
+ [(def: .public <forward>
+ (template (<forward> it)
+ [(|> it (.is <from>) (.as (Primitive <mid>)) <$> (.is (Primitive <to>)))]))
- (template: .public (<backward> it)
- [(|> it (.is (Primitive <to>)) <$'> (.is (Primitive <mid>)) (.as <from>))])]
+ (def: .public <backward>
+ (template (<backward> it)
+ [(|> it (.is (Primitive <to>)) <$'> (.is (Primitive <mid>)) (.as <from>))]))]
[as_byte .Int ..long_to_byte "java.lang.Long" ..byte_to_long "java.lang.Byte" of_byte]
[as_short .Int ..long_to_short "java.lang.Long" ..short_to_long "java.lang.Short" of_short]
@@ -281,7 +285,7 @@
(def: (manual_primitive_type class)
(-> Text (Maybe Code))
(case class
- (^.template [<prim> <type>]
+ (^.with_template [<prim> <type>]
[<prim>
{.#Some (' <type>)}])
(["boolean" (Primitive "java.lang.Boolean")]
@@ -300,7 +304,7 @@
(def: (auto_primitive_type class)
(-> Text (Maybe Code))
(case class
- (^.template [<prim> <type>]
+ (^.with_template [<prim> <type>]
[<prim>
{.#Some (' <type>)}])
(["boolean" .Bit]
@@ -423,7 +427,7 @@
{#GenericArray param}
(format "[" (simple_class$ env param))
- (^.template [<prim> <class>]
+ (^.with_template [<prim> <class>]
[{#GenericClass <prim> {.#End}}
<class>])
(["boolean" "[Z"]
@@ -464,7 +468,7 @@
(def: (pre_walk_replace f input)
(-> (-> Code Code) Code Code)
(case (f input)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[meta {<tag> parts}]
[meta {<tag> (list#each (pre_walk_replace f) parts)}]])
([.#Form]
@@ -515,7 +519,7 @@
(in (`' ((~ (code.text (format "jvm invokestatic" ":" class_name ":" method_name ":" (text.interposed "," arg_decls'))))
(~+ args))))))
-(template [<name> <jvm_op>]
+(with_template [<name> <jvm_op>]
[(def: (<name> params class_name method_name arg_decls)
(-> (List Type_Parameter) Text Text (List ArgDecl) (Parser Code))
(do <>.monad
@@ -600,7 +604,7 @@
(<code>.tuple (do <>.monad
[component again^]
(case component
- (^.template [<class> <name>]
+ (^.with_template [<class> <name>]
[{#GenericClass <name> {.#End}}
(in {#GenericClass <class> (list)})])
(["[Z" "boolean"]
@@ -1391,7 +1395,7 @@
_
return_term))
-(template [<name> <tag> <term_trans>]
+(with_template [<name> <tag> <term_trans>]
[(def: (<name> member return_term)
(-> Import_Member_Declaration Code Code)
(case member
@@ -1417,7 +1421,7 @@
(-> Type_Parameter Code)
(code.symbol ["" name]))
-(template [<name> <byte> <short> <int> <float>]
+(with_template [<name> <byte> <short> <int> <float>]
[(def: (<name> mode [class expression])
(-> Primitive_Mode [Text Code] Code)
(case mode
@@ -1639,7 +1643,7 @@
(syntax (_ [type (..generic_type^ (list))
size <code>.any])
(case type
- (^.template [<type> <array_op>]
+ (^.with_template [<type> <array_op>]
[(pattern {#GenericClass <type> (list)})
(in (list (` (<array_op> (~ size)))))])
(["boolean" "jvm znewarray"]
@@ -1689,7 +1693,7 @@
[array_type (meta.type array_name)
array_jvm_type (type_class_name array_type)]
(case array_jvm_type
- (^.template [<type> <array_op>]
+ (^.with_template [<type> <array_op>]
[<type>
(in (list (` (<array_op> (~ array) (~ idx)))))])
(["[Z" "jvm zaload"]
@@ -1719,7 +1723,7 @@
[array_type (meta.type array_name)
array_jvm_type (type_class_name array_type)]
(case array_jvm_type
- (^.template [<type> <array_op>]
+ (^.with_template [<type> <array_op>]
[<type>
(in (list (` (<array_op> (~ array) (~ idx) (~ value)))))])
(["[Z" "jvm zastore"]
@@ -1747,5 +1751,6 @@
(syntax (_ [type (..generic_type^ (list))])
(in (list (..class_type {#ManualPrM} (list) type)))))
-(template: .public (is type term)
- [(.as type term)])
+(def: .public is
+ (template (is type term)
+ [(.as type term)]))