Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 322 lines (177 sloc) 8.078 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321
My current plan is to implement that "pseudo abstract" "gimme your fella" method...
  this way does feel at least somewhat sane :P




I need to study scala...do I want map(_.yo) ? Futures? Actors? Immutable structures?

shouldn't [1,2,3] be an array?

mirah itself is kind of in the middle, not yet supporting Generics, which would make it even more strongly typed.
my guess is that it wants to support generics and end up typically being as strongly typed as java or scala.
since my pet project wants to basically be less strongly typed than mirah, I assume that means I should work it as a separate project.




integration with jruby: maybe I should just have wrappers around jruby "Fixnum" objects themselves, et al, for my internal objects...and
then descend from JrubyRubyObj instead of RubyObj ... hmm ... hmm ...


for sure I want this to be separate from mirah, since we're heading in different directions :)



do I need block_5 for named blocks with no use within the method?





maybe this would help?



    @Override
    public RubyString convertToString() {
        return this;
    }
    

RubyFixnum uses a long.

what is long.class? It's different than Long.class I believe...hmm...some fake wimpy class?

I need to research more...more...





using long instead of int for Fixnum:
  64-bit: 4.38/4.39 compared to 4.42/4.43 [yipes...hmm...]
so for jruby int., I really only need to recursively call "to_java_internal_obj" then let jruby convert it from there...
  or maybe I can add methods that would allow it....somehow jruby can convert int to Integer...somehow...something...
  or maybe java inline is just cruppy and returns you java shtuffs? I guess it does...hmm...
  
  32-bit int: 2.79 2.82 2.9 a lot

  32-bit long: 3.33 3.38 ai ai 3.4 15% fascinating...shooting for the future would seem to imply 64 bit...plus I can add an int type later...I don't see why not to...and it puts off overflow :P

  
  
is there instanceof much in there ... ?

 def fib(a:int)
  fib(a)
 end

puts fib(33)

fails, adding :void, it succeeds...odd. Very odd...it at least needs a better error message...


I like 3.to_java_i as it's nice and explicit :P [I can filter on these special methods to not abstract them out ... maybe ? ]

3.to_java
=> #<Java::JavaLang::Long:0xc713d2>


jruby uses op_and internally...

jruby's mirah inline relies on jruby's built-in ability to parse and *convert* from java to

  one strike against jruby obj's is...it doesn't have the interfaces "shtuff" built-in...
  but how could/would I ever...I could build arbitrary internal class wrappers

jruby passes around a runtime, internally, as well as having to call things from it...hmm...


maybe I should do a demo that "just uses a special build of jruby that includes RubyFixnum that implements the right interfaces..."

how's the speed if I use a long internally?
  
  
jruby scripting java is kinder on us than mirah is:

>> a = ArrayList.new
=> #<Java::JavaUtil::ArrayList:0x3c9314>
>> a.add(33)
=> true
>> a[0]
=> 33

3.to_java
=> #<Java::JavaLang::Long:0xc713d2>

inline sort should *be the default* give me a break!
now select, reject, I'm ok with those being a copy...actually no I'm not. That's ridiculous.

performance hit of checking for overflow:
 4.15 (~4.2) before, 4.36 (~4.42) (at times) after. meh :P

unable to infer type: https://github.com/rdp/stevia/commit/0a233105bf7ebc51ede991efdc270dd17811a59f argh! matey! needs a better error message! arrr!

it should not let you define the same interface twice, same methods. No that is scawah.

class Yo
 def equals(o:Object)
   print 'in equals'
   false
 end
end

interface Implements__equals do
  def equals(o:Yo):boolean # I guess this will force them to output a boolean last statement, which is ok
  # what about them wanting to be able to output void (or "a boolean here" or what not...)

  end
end


# should I make this class static? cache it [in a hash]?
class RubyInt < Yo
  implements Implements__equals

  $Override
  def equals(o)
    33
  end

end


I can just allow mirah to infer the return type as boolean or RubyObj I think that'll work..I believe so.

there are three classes of methods.
   abc!? # mirah land only -- not worth it for me
   == # never use!
   +- # mirah land only
    << # not even mirah can handle this one? NativeException: java.lang.ClassFormatError: Illegal method name "<<" in class Testy

nice would be an option to have java line numbers [?] I guess it already does through the java compiler...yeah.



java straight, with Integer objects:
  3.70

jdk6 jruby server: 25.14 25.23
jdk7 jruby server: 25.65 25.37
jdk7 jruby client: 48.47


using a cached "one" without the block took me back down to 4.43...cacheing dubious in this case... ?

adding in "more interfaces" seemed to not cause any problem to times.

removing extra "local variables" within the method sped up to

  server: 4.13 (from 4.5)
  client: 12s
  jruby server: 24 (6x)

compared with ~4.01 for mirah straight now

java -server Go2/mir
worked
4.5, 4.4
  4.36 with optimized numbers...which are just too scary overall anyway...maybe...

compared to 4.1, 4.05 mirah normal [not too shabby actually] 26 jruby server


could do:
  def a
   3 + 4
  end
  
  optimize out to
  three = RubyInt.new(3)
  four = RubyInt.new(4)
  def a
   plusser(three) + four
  end

  also maybe "if it's +3 then call takesPlusInt(a)+3 ?
  
def times(call_me:CallableOneArg):Object
  puts call_me
end
 => Yoyo.mir$__xform_tmp_2@5b02a6

can we make this prettier?


should it disallow this?

interface CallableOneArg do
  def call(arg1:RubyObj):RubyObj
  end
end

interface CallableOneArg do
  def call(arg1:RubyObj):RubyObj
  end
end



interface MyInterface do
  def run(a:int); end
end
def go(block:MyInterface)
  block.run(3)
end
go { 4; nil }

Inference Error:
Inferred return type Type(int) is incompatible with declared Type(null)

so...maybe interfaces should be *required* to note the return type? huh?



possible bug:

a = 3
a = 3.times {
  nil
}

failz on assignment...not sure if I care though...


puts 'past go', a # failz...


ruby-zy array stuffs...

[] << 4

stevia vaguely related to chocolate (like java) but flavoring.

go.mr:7: Cannot find instance method <<(int) on java.util.ArrayList
         fib_array << (int(fib_array.get(i)) + int(fib_array.get(i+1)))

is that ever possible?

or

fib_array[23] ? should it infer "get"
[] << 4 ? should it infer...add ?


does their inferred self actually infer self LOL.


does mirah want to be able to do things like that, or


wrap jruby's stdlib itself?

or just wrap stringbuffer,arraylist [or wrappers for the same...]?

ask others for a ruby wishlist? :P


go.mr:10: Cannot find instance method +(java.lang.Object) on java.lang.Object
         fib_array << (fib_array.get(i) + fib_array.get(i+1))

hmm...

RubyObject

 + RubyObject

int + int
string + string
string + fixnum



ooh ooh '' + 3 work :) [just call to_str or what not]

ooh the abstract class can just raise for everything in it :P
  maybe sane hashcodes though...hmm...a sane default hashcode...hmm...
  auto generate a sane hashcode?


charsequence for string :)

my string will have to implement Interface CharSequence I'd wager...so that they can pass through strings and it survive :P



I *need* to be able to say

if 'a' == 'b'
I need it. please? please?!


it needs to check for nil *or* false in if statements...[or does mirah already do this?]


maybe I can let it parse their code along with the sum of the original mirah code iff they make changes to core classes?

[todo: can mirah add to classes later, easily, yet?]


might be nice to have call by arg name as method_name(:abc => :def) or what not. Yeah. If they want a hash they have to make it explicit? hmm...
Something went wrong with that request. Please try again.