headius / duby Goto Github PK
View Code? Open in Web Editor NEWThe Duby Programming Language
Home Page: http://kenai.com/projects/duby
The Duby Programming Language
Home Page: http://kenai.com/projects/duby
The Duby project has been renamed to Mirah and moved to a new repository http://github.com/headius/mirah See http://mirah.org for more information.
The classpath parsing code in lib/duby.rb line:240
when '--classpath', '-c'
args.shift
args.shift.split(RbConfig::CONFIG['PATH_SEPARATOR']).each do |path|
$CLASSPATH << path
end
PATH_SEPARATOR on Ubuntu returns '' as it is not set and thus the parsing fails to correctly parse out the classpath.
This needs a default value of ';' (semi-colon) under Windows and ':' (colon) on *nix. Also where class paths are hardcoded to use ':' (see rake tasks) this should be generated to use the correct delimiter for each OS.
FYI: the error you get on linux is:
llinux:~/duby$ ../jruby/bin/jruby -S rake compile
mkdir -p dist
mkdir -p build
Compiling Ruby sources
Generating Java class DubyCommand to build/org/jruby/duby/DubyCommand.java
javac -d build -cp ../jruby/lib/jruby.jar:. build/org/jruby/duby/DubyCommand.java
Compiling Duby sources
org/jruby/duby/ant/compile.duby:2: cannot load Java class org.jruby.duby.DubyCommand
import org.jruby.duby.DubyCommand
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It is currently possible to access the command line arguments when writing a Duby script like this
class MyClass
def self.main(args:String[])
puts args
end
end
But it's not possible to use ARGV like it is in Ruby. This script will currently fail:
puts ARGV
It would be cool if ARGV would be available outside explicitly declared classes.
In the generated java code, args
is available at the moment, but at compile time, the type of args cannot be inferred. I guess it could be enough to globally declare args
as String[]
but I prefer the usage of ARGV outside of an explicit main method.
Accessing nested classes currently tries to call the nested class as a method on the parent, rather than just getting that class.
Current workaround is to import the nested class itself, via this syntax:
import "Child", "com.example.Parent$Child"
And then just use Child
.
An example, with the Android API:
hello = self
btn.setOnClickListener do
def onClick(v)
return if hello.txt.getText.toString.length == 0
hello.addMessage("hellotester", Hello(v.getContext).txt.getText.toString)
message = Bundle.new
message.putString("say", Hello(v.getContext).txt.getText.toString)
Message m = Message.obtain
m.setData(message)
hello.client.handler.sendMessage(m)
hello.txt.setText("")
end
end
hello
is not accessible. Workaround here is to use Hello(v.getContext)
(where Hello
is the name of the class).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.