static method call - bug or a feature?

43 views
Skip to first unread message

Michal Hantl

unread,
Sep 28, 2010, 2:39:25 AM9/28/10
to mi...@googlegroups.com
class TestOffer < Model
...

def self.blank
o = new
...
o
end

end

o = TestOffer.blank()
puts o.getClass.toString() #prints "class models.Offer"

-- Is this a bug or a feature?


(I'm using new-ish Mirah, since the new one breaks my old Dubious (new
Dubious is unusably slow))

--
S pozdravem, Regards
Michal Hantl

gtalk/jabber: mic...@hantl.cz
icq: 241813215

John Woodell

unread,
Sep 28, 2010, 4:35:53 AM9/28/10
to mi...@googlegroups.com
Please ls your config dir. What do you see in there?

Michal Hantl

unread,
Sep 28, 2010, 4:46:45 AM9/28/10
to mi...@googlegroups.com
Sorry for that mystification, this is the propper code:

class Offer < Model
def self.blank
new
end
end

class TestOffer < Offer
end

o = TestOffer.blank()
puts o.getClass.toString() #prints "class models.Offer"


ls:
michal@domov:~/mystuff/Kyle$ ls config
application.properties asset.properties build.properties

John Woodell

unread,
Sep 28, 2010, 11:46:26 AM9/28/10
to mi...@googlegroups.com
OK, so it mirah slow to compile, or is the dubious app slow to spin-up?

Rib Rdb

unread,
Sep 28, 2010, 11:50:47 AM9/28/10
to mi...@googlegroups.com

That's how java static methods work. I've got a few ideas for ways we could implement class methods like ruby has, where self is the class you you used to call the method, but nothing is implemented yet. For now your best bet is to copy that method into each subclass.

-- Sent from my phone

Michal Hantl

unread,
Sep 28, 2010, 1:23:22 PM9/28/10
to mi...@googlegroups.com
I did post about speed Issues earlier - 18s lag after changing a view
is way too much.

I'm currently doing Mirah fulltime as a startup and older version of
Dubious works great for me (even though it has some crazy
bugs/features).

I've extended dubious a little (more freedom in controllers, testing
and file uploads) and will try the new one later. (Last time I lost a
dat migrating my app to the new Dubious and back.)

Michal Hantl

unread,
Sep 28, 2010, 1:19:01 PM9/28/10
to mi...@googlegroups.com
Thats what I thought. Thanks for explenation!

Which books do you recomend to learn Java?
(I'm used to programming in Ruby, JS, PHP did some Haskell and Prolog)

John Woodell

unread,
Sep 28, 2010, 1:56:59 PM9/28/10
to mi...@googlegroups.com
Great, you should sync up with Nick, and get those new features into a fork, and send us a pull request.

Nick Howard

unread,
Sep 28, 2010, 4:07:45 PM9/28/10
to mi...@googlegroups.com
On Tue, Sep 28, 2010 at 11:23 AM, Michal Hantl <michal...@gmail.com> wrote:
I did post about speed Issues earlier - 18s lag after changing a view
is way too much.

I'm currently doing Mirah fulltime as a startup and older version of
Dubious works great for me (even though it has some crazy
bugs/features).

I've extended dubious a little (more freedom in controllers, testing
and file uploads) and will try the new one later. (Last time I lost a
dat migrating my app to the new Dubious and back.)
The controller compilation step should be much faster once the workaround I added to the Rakefile to deal with some odd compiler behavior in Mirah involving keeping state around in such a way that everything blows up. I'm not sure whether or not the new parser fixes it.

You could try commenting out my workaround and testing it. I plan on getting back to it sometime this week.



--
-Nick Howard
http://blog.baroquebobcat.com/


Rib Rdb

unread,
Sep 29, 2010, 5:16:50 PM9/29/10
to mi...@googlegroups.com
I found a jruby problem that I think was responsible for the issues in your gist nick.  If you build jruby from http://github.com/ribrdb/jruby.git  the issue should be fixed.  Too bad we didn't find this before they released 1.5.3.

v6ak

unread,
Oct 4, 2010, 4:19:27 AM10/4/10
to The Mirah Programming Language
Do you mean the Scala-like way? If you use object keyword instead of
the class keyword, it adds suffix "$" to the generated class and
creates a wrapper class without the suffix.
However, I think that there is no way to do it without a leaky
abstraction. The mentioned way requires recompilation of all
subclasses after adding a static method before using it. If it is not
performed, it can be compiled, but it has a different meaning.

On Sep 28, 5:50 pm, Rib Rdb <rib...@gmail.com> wrote:
> That's how java static methods work. I've got a few ideas for ways we could
> implement class methods like ruby has, where self is the class you you used
> to call the method, but nothing is implemented yet. For now your best bet is
> to copy that method into each subclass.
>
> -- Sent from my phone
> On Sep 28, 2010 1:47 AM, "Michal Hantl" <michal.ha...@gmail.com> wrote:
>
> > Sorry for that mystification, this is the propper code:
>
> > class Offer < Model
> > def self.blank
> > new
> > end
> > end
>
> > class TestOffer < Offer
> > end
>
> > o = TestOffer.blank()
> > puts o.getClass.toString() #prints "class models.Offer"
>
> > ls:
> > michal@domov:~/mystuff/Kyle$ ls config
> > application.properties asset.properties build.properties
>
> > On 28 September 2010 10:35, John Woodell <mando.woo...@gmail.com> wrote:
> >> Please ls your config dir. What do you see in there?
>
> >> On Mon, Sep 27, 2010 at 11:39 PM, Michal Hantl <michal.ha...@gmail.com>
Reply all
Reply to author
Forward
0 new messages