aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/ffi.rb.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/ffi.rb.lux')
-rw-r--r--stdlib/source/library/lux/ffi.rb.lux31
1 files changed, 26 insertions, 5 deletions
diff --git a/stdlib/source/library/lux/ffi.rb.lux b/stdlib/source/library/lux/ffi.rb.lux
index 8bffde0d6..b0d3a5c9b 100644
--- a/stdlib/source/library/lux/ffi.rb.lux
+++ b/stdlib/source/library/lux/ffi.rb.lux
@@ -23,11 +23,13 @@
["." code]
["." template]]]])
-(abstract: .public (Object brand) Any)
+(abstract: .public (Object brand)
+ {}
+ Any)
(template [<name>]
[(with_expansions [<brand> (template.identifier [<name> "'"])]
- (abstract: <brand> Any)
+ (abstract: <brand> {} Any)
(type: .public <name>
(..Object <brand>)))]
@@ -225,7 +227,26 @@
(:as ..Function (~ source))
(~+ (list\map (with_nil g!temp) g!inputs)))))))))))
-(syntax: .public (import: {[?module import] ..import})
+(syntax: .public (import: [[?module import] ..import])
+ {#.doc (example "Easily import types, methods, functions and constants."
+ (import: Stat
+ ["#::."
+ (executable? [] Bit)
+ (size Int)])
+
+ (import: File #as RubyFile
+ ["#::."
+ (#static SEPARATOR ..String)
+ (#static open [Path ..String] #io #try RubyFile)
+ (#static stat [Path] #io #try Stat)
+ (#static delete [Path] #io #try Int)
+ (#static file? [Path] #io #try Bit)
+ (#static directory? [Path] #io #try Bit)
+
+ (read [] #io #try Binary)
+ (write [Binary] #io #try Int)
+ (flush [] #io #try #? Any)
+ (close [] #io #try #? Any)]))}
(with_identifiers [g!temp]
(case import
(#Class [class alias format members])
@@ -251,7 +272,7 @@
(case member
(#Field [static? field alias fieldT])
(if static?
- (` ((~! syntax:) ((~ (qualify (maybe.else field alias))))
+ (` ((~! syntax:) ((~ (qualify (maybe.else field alias))) [])
(\ (~! meta.monad) (~' in)
(list (` (.:as (~ (nilable_type fieldT))
(.exec
@@ -326,7 +347,7 @@
#.None
(list)))
("ruby constant" (~ (code.text name)))))]
- (in (list (` ((~! syntax:) ((~ (code.local_identifier (maybe.else name alias))))
+ (in (list (` ((~! syntax:) ((~ (code.local_identifier (maybe.else name alias))) [])
(\ (~! meta.monad) (~' in)
(list (` (.:as (~ (nilable_type fieldT)) (~ imported))))))))))
)))