diff options
21 files changed, 106 insertions, 106 deletions
diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index c6f7e4b58..9fc30c4d1 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -237,7 +237,7 @@ Called by `imenu--generic-function'." "infix" "format" "`" "`'" "'" "do-template" - "object" "jvm-import" "do-to" "with-open" "synchronized" "class-for" + "object" "import" "do-to" "with-open" "synchronized" "class-for" "doc" "regex" ) t) @@ -391,7 +391,7 @@ This function also returns nil meaning don't specify the indentation." (synchronized 'defun) (object 'defun) (do-to 'defun) - (jvm-import 'defun) + (import 'defun) (testing 'defun) (comment 'defun) (doE 'defun) diff --git a/new-luxc/source/luxc/generator.lux b/new-luxc/source/luxc/generator.lux index b447dd7a8..00a50fbed 100644 --- a/new-luxc/source/luxc/generator.lux +++ b/new-luxc/source/luxc/generator.lux @@ -9,7 +9,7 @@ (coll ["D" dict] [array #+ Array])) [macro #+ Monad<Lux>] - host + [host] [io]) (luxc ["&" base] ["&;" io] @@ -108,7 +108,7 @@ (#R;Error error) (wrap (#R;Error error))))) -(jvm-import org.objectweb.asm.MethodVisitor) +(host;import org.objectweb.asm.MethodVisitor) (def: init-cursor Cursor ["" +0 +0]) diff --git a/new-luxc/source/luxc/generator/common.jvm.lux b/new-luxc/source/luxc/generator/common.jvm.lux index c5fe8fc0a..095f41945 100644 --- a/new-luxc/source/luxc/generator/common.jvm.lux +++ b/new-luxc/source/luxc/generator/common.jvm.lux @@ -5,21 +5,21 @@ (data ["R" result] (coll ["d" dict]) text/format) - [host #+ jvm-import]) + [host]) (luxc (generator (host ["$" jvm] (jvm ["$t" type] ["$d" def] ["$i" inst]))))) ## [Host] -(jvm-import org.objectweb.asm.Opcodes +(host;import org.objectweb.asm.Opcodes (#static V1_6 int)) -(jvm-import java.lang.Object) +(host;import java.lang.Object) -(jvm-import (java.lang.Class a)) +(host;import (java.lang.Class a)) -(jvm-import java.lang.ClassLoader +(host;import java.lang.ClassLoader (loadClass [String] (Class Object))) ## [Types] diff --git a/new-luxc/source/luxc/generator/eval.jvm.lux b/new-luxc/source/luxc/generator/eval.jvm.lux index e7567f1fa..e6650953f 100644 --- a/new-luxc/source/luxc/generator/eval.jvm.lux +++ b/new-luxc/source/luxc/generator/eval.jvm.lux @@ -4,7 +4,7 @@ (data ["R" result] text/format) [macro #+ Monad<Lux> "Lux/" Monad<Lux>] - [host #+ jvm-import do-to]) + [host #+ do-to]) (luxc ["&" base] (lang ["la" analysis] ["ls" synthesis]) @@ -17,16 +17,16 @@ ["$i" inst]))) )) -(jvm-import java.lang.Object) -(jvm-import java.lang.String) +(host;import java.lang.Object) +(host;import java.lang.String) -(jvm-import java.lang.reflect.Field +(host;import java.lang.reflect.Field (get [Object] Object)) -(jvm-import (java.lang.Class a) +(host;import (java.lang.Class a) (getField [String] Field)) -(jvm-import org.objectweb.asm.Opcodes +(host;import org.objectweb.asm.Opcodes (#static ACC_PUBLIC int) (#static ACC_SUPER int) (#static ACC_FINAL int) @@ -36,7 +36,7 @@ (#static V1_6 int) ) -(jvm-import org.objectweb.asm.MethodVisitor +(host;import org.objectweb.asm.MethodVisitor (visitCode [] void) (visitEnd [] void) (visitLdcInsn [Object] void) @@ -44,10 +44,10 @@ (visitInsn [int] void) (visitMaxs [int int] void)) -(jvm-import org.objectweb.asm.FieldVisitor +(host;import org.objectweb.asm.FieldVisitor (visitEnd [] void)) -(jvm-import org.objectweb.asm.ClassWriter +(host;import org.objectweb.asm.ClassWriter (#static COMPUTE_MAXS int) (new [int]) (visit [int int String String String (Array String)] void) diff --git a/new-luxc/source/luxc/generator/host/jvm.lux b/new-luxc/source/luxc/generator/host/jvm.lux index d67b6ef91..4b4b1d38e 100644 --- a/new-luxc/source/luxc/generator/host/jvm.lux +++ b/new-luxc/source/luxc/generator/host/jvm.lux @@ -6,14 +6,14 @@ [macro] (macro [code] ["s" syntax #+ syntax:]) - [host #+ jvm-import])) + [host])) ## [Host] -(jvm-import org.objectweb.asm.MethodVisitor) +(host;import org.objectweb.asm.MethodVisitor) -(jvm-import org.objectweb.asm.ClassWriter) +(host;import org.objectweb.asm.ClassWriter) -(jvm-import #long org.objectweb.asm.Label +(host;import #long org.objectweb.asm.Label (new [])) ## [Type] diff --git a/new-luxc/source/luxc/generator/host/jvm/def.lux b/new-luxc/source/luxc/generator/host/jvm/def.lux index 8b961b29a..bb1d2cd94 100644 --- a/new-luxc/source/luxc/generator/host/jvm/def.lux +++ b/new-luxc/source/luxc/generator/host/jvm/def.lux @@ -5,15 +5,15 @@ [product] (coll ["a" array] [list "L/" Functor<List>])) - [host #+ jvm-import do-to]) + [host #+ do-to]) ["$" ..] (.. ["$t" type])) ## [Host] -(jvm-import #long java.lang.Object) -(jvm-import #long java.lang.String) +(host;import #long java.lang.Object) +(host;import #long java.lang.String) -(jvm-import org.objectweb.asm.Opcodes +(host;import org.objectweb.asm.Opcodes (#static ACC_PUBLIC int) (#static ACC_PROTECTED int) (#static ACC_PRIVATE int) @@ -40,15 +40,15 @@ (#static V1_8 int) ) -(jvm-import org.objectweb.asm.FieldVisitor +(host;import org.objectweb.asm.FieldVisitor (visitEnd [] void)) -(jvm-import org.objectweb.asm.MethodVisitor +(host;import org.objectweb.asm.MethodVisitor (visitCode [] void) (visitMaxs [int int] void) (visitEnd [] void)) -(jvm-import org.objectweb.asm.ClassWriter +(host;import org.objectweb.asm.ClassWriter (#static COMPUTE_MAXS int) (new [int]) (visit [int int String String String (Array String)] void) diff --git a/new-luxc/source/luxc/generator/host/jvm/inst.lux b/new-luxc/source/luxc/generator/host/jvm/inst.lux index af5f6f6d8..6085ff72b 100644 --- a/new-luxc/source/luxc/generator/host/jvm/inst.lux +++ b/new-luxc/source/luxc/generator/host/jvm/inst.lux @@ -4,7 +4,7 @@ ["p" parser]) (data text/format (coll [list "L/" Functor<List>])) - [host #+ jvm-import do-to] + [host #+ do-to] [macro] (macro [code] ["s" syntax #+ syntax:])) @@ -12,8 +12,8 @@ (.. ["$t" type])) ## [Host] -(jvm-import #long java.lang.Object) -(jvm-import #long java.lang.String) +(host;import #long java.lang.Object) +(host;import #long java.lang.String) (syntax: (declare [codes (p;many s;local-symbol)]) (|> codes @@ -34,7 +34,7 @@ LADD LSUB LMUL LDIV LREM LCMP DADD DSUB DMUL DDIV DREM DCMPG) <return> (declare RETURN IRETURN LRETURN DRETURN ARETURN)] - (jvm-import org.objectweb.asm.Opcodes + (host;import org.objectweb.asm.Opcodes <primitive> (#static CHECKCAST int) @@ -82,13 +82,13 @@ <return> )) -(jvm-import org.objectweb.asm.FieldVisitor +(host;import org.objectweb.asm.FieldVisitor (visitEnd [] void)) -(jvm-import org.objectweb.asm.Label +(host;import org.objectweb.asm.Label (new [])) -(jvm-import org.objectweb.asm.MethodVisitor +(host;import org.objectweb.asm.MethodVisitor (visitCode [] void) (visitMaxs [int int] void) (visitEnd [] void) diff --git a/new-luxc/source/luxc/generator/procedure/common.jvm.lux b/new-luxc/source/luxc/generator/procedure/common.jvm.lux index 106b6a0f5..d04a91141 100644 --- a/new-luxc/source/luxc/generator/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/generator/procedure/common.jvm.lux @@ -8,7 +8,7 @@ [macro #+ Monad<Lux> with-gensyms] (macro [code] ["s" syntax #+ syntax:]) - [host #+ jvm-import]) + [host]) (luxc ["&" base] (lang ["la" analysis] ["ls" synthesis]) @@ -22,11 +22,11 @@ ["$d" def] ["$i" inst]))))) -(jvm-import java.lang.Long +(host;import java.lang.Long (#static MIN_VALUE Long) (#static MAX_VALUE Long)) -(jvm-import java.lang.Double +(host;import java.lang.Double (#static MIN_VALUE Double) (#static MAX_VALUE Double) (#static NaN Double) diff --git a/new-luxc/source/luxc/generator/runtime.jvm.lux b/new-luxc/source/luxc/generator/runtime.jvm.lux index fe7a4b2cb..e094334c0 100644 --- a/new-luxc/source/luxc/generator/runtime.jvm.lux +++ b/new-luxc/source/luxc/generator/runtime.jvm.lux @@ -5,7 +5,7 @@ text/format) [math] [macro #+ Monad<Lux> "Lux/" Monad<Lux>] - [host #+ jvm-import do-to]) + [host #+ do-to]) (luxc ["&" base] (lang ["la" analysis] ["ls" synthesis]) @@ -17,23 +17,23 @@ ["$d" def] ["$i" inst]))))) -(jvm-import java.lang.Object) -(jvm-import java.lang.String) +(host;import java.lang.Object) +(host;import java.lang.String) -(jvm-import java.lang.reflect.Field +(host;import java.lang.reflect.Field (get [Object] #try Object)) -(jvm-import (java.lang.Class a) +(host;import (java.lang.Class a) (getField [String] Field)) -(jvm-import org.objectweb.asm.Opcodes +(host;import org.objectweb.asm.Opcodes (#static ACC_PUBLIC int) (#static ACC_SUPER int) (#static ACC_FINAL int) (#static ACC_STATIC int) (#static V1_6 int)) -(jvm-import org.objectweb.asm.ClassWriter +(host;import org.objectweb.asm.ClassWriter (#static COMPUTE_MAXS int) (new [int]) (visit [int int String String String (Array String)] void) diff --git a/new-luxc/source/luxc/generator/structure.jvm.lux b/new-luxc/source/luxc/generator/structure.jvm.lux index 8662aaa8d..64848546f 100644 --- a/new-luxc/source/luxc/generator/structure.jvm.lux +++ b/new-luxc/source/luxc/generator/structure.jvm.lux @@ -5,7 +5,7 @@ (data text/format (coll [list])) [macro #+ Monad<Lux> "Lux/" Monad<Lux>] - [host #+ jvm-import do-to]) + [host #+ do-to]) (luxc ["&" base] (lang ["la" analysis] ["ls" synthesis]) diff --git a/new-luxc/source/luxc/host.jvm.lux b/new-luxc/source/luxc/host.jvm.lux index 00957f3d4..e22ab4fd1 100644 --- a/new-luxc/source/luxc/host.jvm.lux +++ b/new-luxc/source/luxc/host.jvm.lux @@ -8,28 +8,28 @@ (coll ["d" dict] [array #+ Array])) [macro #+ Monad<Lux>] - [host #+ jvm-import do-to object] + [host #+ do-to object] [io]) (luxc ["&" base] (generator ["&&;" common]) )) -(jvm-import java.lang.reflect.AccessibleObject +(host;import java.lang.reflect.AccessibleObject (setAccessible [boolean] void)) -(jvm-import java.lang.reflect.Method +(host;import java.lang.reflect.Method (invoke [Object (Array Object)] #try Object)) -(jvm-import (java.lang.Class a) +(host;import (java.lang.Class a) (getDeclaredMethod [String (Array (Class Object))] #try Method)) -(jvm-import java.lang.Object +(host;import java.lang.Object (getClass [] (Class Object))) -(jvm-import java.lang.Integer +(host;import java.lang.Integer (#static TYPE (Class Integer))) -(jvm-import java.lang.ClassLoader) +(host;import java.lang.ClassLoader) (def: ClassLoader::defineClass Method diff --git a/new-luxc/source/luxc/io.jvm.lux b/new-luxc/source/luxc/io.jvm.lux index cb37c69a9..e8f403d6d 100644 --- a/new-luxc/source/luxc/io.jvm.lux +++ b/new-luxc/source/luxc/io.jvm.lux @@ -7,20 +7,20 @@ [text "T/" Eq<Text>] text/format) [macro] - host) + [host]) (luxc ["&" base])) -(jvm-import java.io.File +(host;import java.io.File (new [String String]) (exists [] #io #try boolean)) -(jvm-import java.io.Reader +(host;import java.io.Reader (close [] #io #try void)) -(jvm-import java.io.FileReader +(host;import java.io.FileReader (new [File])) -(jvm-import java.io.BufferedReader +(host;import java.io.BufferedReader (new [Reader]) (readLine [] #io #try #? String)) diff --git a/new-luxc/test/test/luxc/generator/procedure/common.jvm.lux b/new-luxc/test/test/luxc/generator/procedure/common.jvm.lux index 1b150561c..1da4d7c62 100644 --- a/new-luxc/test/test/luxc/generator/procedure/common.jvm.lux +++ b/new-luxc/test/test/luxc/generator/procedure/common.jvm.lux @@ -13,7 +13,7 @@ [list])) ["r" math/random "r/" Monad<Random>] [macro #+ Monad<Lux>] - [host #+ jvm-import] + [host] test) (luxc (lang ["ls" synthesis]) [analyser] @@ -43,7 +43,7 @@ ["bit or" bit;or] ["bit xor" bit;xor] ["bit shift-left" bit;shift-left] - ["bit unsigned-shift-right" bit;unsigned-shift-right] + ["bit unsigned-shift-right" bit;shift-right] )] ($_ seq (test "bit count" @@ -62,7 +62,7 @@ (#ls;Nat param))))) (macro;run (init-compiler [])) (case> (#R;Success valueG) - (i.= (bit;shift-right param (nat-to-int subject)) + (i.= (bit;signed-shift-right param (nat-to-int subject)) (:! Int valueG)) _ diff --git a/new-luxc/test/test/luxc/generator/structure.lux b/new-luxc/test/test/luxc/generator/structure.lux index 1e4f14518..4652c4bd9 100644 --- a/new-luxc/test/test/luxc/generator/structure.lux +++ b/new-luxc/test/test/luxc/generator/structure.lux @@ -11,7 +11,7 @@ [list])) ["r" math/random "r/" Monad<Random>] [macro #+ Monad<Lux>] - [host #+ jvm-import] + [host] test) (luxc (lang ["ls" synthesis]) [analyser] @@ -22,7 +22,7 @@ ["@;" common])) (test/luxc common)) -(jvm-import java.lang.Integer) +(host;import java.lang.Integer) (def: gen-primitive (r;Random ls;Synthesis) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 62a3da2a6..ea4171184 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -1877,7 +1877,7 @@ (#;Left _) (macro;fail (format "Unknown class: " class-name)))) -(syntax: #export (jvm-import [#let [imports (class-imports *compiler*)]] +(syntax: #export (import [#let [imports (class-imports *compiler*)]] [long-name? (s;this? (' #long))] [class-decl (class-decl^ imports)] [#let [full-class-name (product;left class-decl) @@ -1888,7 +1888,7 @@ "Their methods, fields and enum options can also be imported." "Also, classes which get imported into a module can also be referred-to with their short names in other macros that require JVM classes." "Examples:" - (jvm-import java.lang.Object + (import java.lang.Object (new []) (equals [Object] boolean) (wait [int] #io #try void)) @@ -1897,24 +1897,24 @@ "#try means that the computation might throw an exception, and the return value will be wrapped by the Error type." "#io means the computation has side effects, and will be wrapped by the IO type." "These options must show up in the following order [#io #try #?] (although, each option can be used independently)." - (jvm-import java.lang.String + (import java.lang.String (new [(Array byte)]) (#static valueOf [char] String) (#static valueOf #as int-valueOf [int] String)) - (jvm-import #long (java.util.List e) + (import #long (java.util.List e) (size [] int) (get [int] e)) - (jvm-import (java.util.ArrayList a) + (import (java.util.ArrayList a) ([T] toArray [(Array T)] (Array T))) "#long makes it so the class-type that is generated is of the fully-qualified name." "In this case, it avoids a clash between the java.util.List type, and Lux's own List type." - (jvm-import java.lang.Character$UnicodeScript + (import java.lang.Character$UnicodeScript (#enum ARABIC CYRILLIC LATIN)) "All enum options to be imported must be specified." - (jvm-import #long (lux.concurrency.promise.JvmPromise A) + (import #long (lux.concurrency.promise.JvmPromise A) (resolve [A] boolean) (poll [] A) (wasResolved [] boolean) diff --git a/stdlib/source/lux/world/blob.jvm.lux b/stdlib/source/lux/world/blob.jvm.lux index 4d7f78199..249cee9eb 100644 --- a/stdlib/source/lux/world/blob.jvm.lux +++ b/stdlib/source/lux/world/blob.jvm.lux @@ -7,14 +7,14 @@ [maybe] ["R" result] text/format) - [host #+ jvm-import])) + [host])) (exception: #export Index-Out-Of-Bounds) (exception: #export Inverted-Range) (type: #export Blob host;Byte-Array) -(jvm-import java.util.Arrays +(host;import java.util.Arrays (#static copyOfRange [Byte-Array int int] Byte-Array) (#static equals [Byte-Array Byte-Array] boolean)) diff --git a/stdlib/source/lux/world/env.jvm.lux b/stdlib/source/lux/world/env.jvm.lux index 29266cc84..a3a58bc61 100644 --- a/stdlib/source/lux/world/env.jvm.lux +++ b/stdlib/source/lux/world/env.jvm.lux @@ -5,25 +5,25 @@ (coll [list "L/" Functor<List>] ["d" dict])) [io #- run] - [host #+ jvm-import])) + [host])) -(jvm-import java.lang.String) +(host;import java.lang.String) -(jvm-import (java.util.Map$Entry k v) +(host;import (java.util.Map$Entry k v) (getKey [] k) (getValue [] v)) -(jvm-import (java.util.Iterator a) +(host;import (java.util.Iterator a) (hasNext [] boolean) (next [] a)) -(jvm-import (java.util.Set a) +(host;import (java.util.Set a) (iterator [] (Iterator a))) -(jvm-import (java.util.Map k v) +(host;import (java.util.Map k v) (entrySet [] (Set (Map$Entry k v)))) -(jvm-import java.lang.System +(host;import java.lang.System (#static getenv [] (java.util.Map String String))) (def: (consume-iterator f iterator) diff --git a/stdlib/source/lux/world/fs.jvm.lux b/stdlib/source/lux/world/fs.jvm.lux index 665dfaea1..44f028f0b 100644 --- a/stdlib/source/lux/world/fs.jvm.lux +++ b/stdlib/source/lux/world/fs.jvm.lux @@ -10,13 +10,13 @@ ["d" duration]) (world [blob #+ Blob]) [io] - [host #+ jvm-import])) + [host])) (exception: Could-Not-Read-All-Data) (type: #export File Text) -(jvm-import #long java.io.File +(host;import #long java.io.File (new [String]) (exists [] #io #try boolean) (mkdir [] #io #try boolean) @@ -33,20 +33,20 @@ (canWrite [] #io #try boolean) (canExecute [] #io #try boolean)) -(jvm-import java.lang.AutoCloseable +(host;import java.lang.AutoCloseable (close [] #io #try void)) -(jvm-import java.io.OutputStream +(host;import java.io.OutputStream (write [Byte-Array] #io #try void) (flush [] #io #try void)) -(jvm-import java.io.FileOutputStream +(host;import java.io.FileOutputStream (new [java.io.File boolean] #io #try)) -(jvm-import java.io.InputStream +(host;import java.io.InputStream (read [Byte-Array] #io #try int)) -(jvm-import java.io.FileInputStream +(host;import java.io.FileInputStream (new [java.io.File] #io #try)) (do-template [<name> <flag>] diff --git a/stdlib/source/lux/world/net/tcp.jvm.lux b/stdlib/source/lux/world/net/tcp.jvm.lux index bb7a36c39..25d6bb6ae 100644 --- a/stdlib/source/lux/world/net/tcp.jvm.lux +++ b/stdlib/source/lux/world/net/tcp.jvm.lux @@ -8,27 +8,27 @@ (type opaque) (world [blob #+ Blob]) [io] - [host #+ jvm-import]) + [host]) [..]) -(jvm-import java.lang.AutoCloseable +(host;import java.lang.AutoCloseable (close [] #io #try void)) -(jvm-import java.io.Flushable +(host;import java.io.Flushable (flush [] #io #try void)) -(jvm-import java.io.InputStream +(host;import java.io.InputStream (read [Byte-Array int int] #io #try int)) -(jvm-import java.io.OutputStream +(host;import java.io.OutputStream (write [Byte-Array int int] #io #try void)) -(jvm-import java.net.Socket +(host;import java.net.Socket (new [String int] #io #try) (getInputStream [] #io #try InputStream) (getOutputStream [] #io #try OutputStream)) -(jvm-import java.net.ServerSocket +(host;import java.net.ServerSocket (new [int] #io #try) (accept [] #io #try Socket)) diff --git a/stdlib/source/lux/world/net/udp.jvm.lux b/stdlib/source/lux/world/net/udp.jvm.lux index 4bf95a03e..e76a1e009 100644 --- a/stdlib/source/lux/world/net/udp.jvm.lux +++ b/stdlib/source/lux/world/net/udp.jvm.lux @@ -10,27 +10,27 @@ (type opaque) (world [blob #+ Blob]) [io] - [host #+ jvm-import]) + [host]) [..]) -(jvm-import java.lang.AutoCloseable +(host;import java.lang.AutoCloseable (close [] #io #try void)) -(jvm-import java.io.Flushable +(host;import java.io.Flushable (flush [] #io #try void)) -(jvm-import java.net.InetAddress +(host;import java.net.InetAddress (#static getAllByName [String] #io #try (Array InetAddress)) (getHostAddress [] String)) -(jvm-import java.net.DatagramPacket +(host;import java.net.DatagramPacket (new #as new|send [Byte-Array int int InetAddress int]) (new #as new|receive [Byte-Array int int]) (getAddress [] InetAddress) (getPort [] int) (getLength [] int)) -(jvm-import java.net.DatagramSocket +(host;import java.net.DatagramSocket (new #as new|client [] #io #try) (new #as new|server [int] #io #try) (receive [DatagramPacket] #io #try void) diff --git a/stdlib/test/test/lux/host.jvm.lux b/stdlib/test/test/lux/host.jvm.lux index 6d991d489..ba027150a 100644 --- a/stdlib/test/test/lux/host.jvm.lux +++ b/stdlib/test/test/lux/host.jvm.lux @@ -1,25 +1,25 @@ (;module: lux (lux [io] - (control ["M" monad #+ do Monad] + (control [monad #+ do Monad] pipe) (data text/format [number] [product] [text "Text/" Eq<Text>]) - ["&" host #+ jvm-import class: interface: object] + ["&" host #+ class: interface: object] ["r" math/random]) lux/test) -(jvm-import java.lang.Exception +(&;import java.lang.Exception (new [String])) -(jvm-import java.lang.Object) +(&;import java.lang.Object) -(jvm-import (java.lang.Class a) +(&;import (java.lang.Class a) (getName [] String)) -(jvm-import java.lang.System +(&;import java.lang.System (#static out java.io.PrintStream) (#static currentTimeMillis [] #io long) (#static getenv [String] #io #? String)) |