Guys, any explanations about this?

classic Classic list List threaded Threaded
24 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Guys, any explanations about this?

Behrang Saeedzadeh
Hi all,

Something seems to be wrong here:

http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/main/org/codehaus/groovy/runtime/ArrayUtil.java

Any ideas what's going on here?

Cheers,
Behrang Saeedzadeh
http://www.behrang.org
Reply | Threaded
Open this post in threaded view
|

Re: Guys, any explanations about this?

HamletDRC2
OK, so I was the one that posted the link to Twitter because I was surprised by the implementation. However, it wasn't explained well and out of context people did not understand this class.

First: the package is org.codehaus.groovy.runtime. This is NOT a class that any user of Groovy will ever use. There are plenty of XML utilities in groovy.lang or groovy.xml for you to use.

Second: This class is never invoked from code. It exists so that byte code statements have something to link against. If you dump the stack language of a .class file you may indeed see a "INVOKESTATIC org/codehaus/groovy/runtime/XMLUtil" invocation. This logic is used around the CallSite writing features.

Third: Implementing a dynamic language (Groovy) in a static language (Java) on a type less virtual machine (JVM) is hard. Every language has their work arounds. We generated some code so that we had something to link against. At one point, JRuby was generating reams of interfaces (IIRC) and have you seen the implementation of OpenJDK? Ever notice now many methods are overloaded for all the primitives plus Object. These are all workarounds to get the end user a good programming experience while still running on the JVM.

I am sure I butchered some of the explanations here, but the intent stands.
Reply | Threaded
Open this post in threaded view
|

Re: Guys, any explanations about this?

Alex Tkachman
In reply to this post by Behrang Saeedzadeh
This is trivial bytecode shortcut for creating array out of objects on
top of stack What's wrong with it?

On Tue, Nov 30, 2010 at 4:37 AM, Behrang Saeedzadeh <[hidden email]> wrote:

> Hi all,
>
> Something seems to be wrong here:
>
> http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/main/org/codehaus/groovy/runtime/ArrayUtil.java
>
> Any ideas what's going on here?
>
> Cheers,
> Behrang Saeedzadeh
> http://www.behrang.org
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Guys, any explanations about this?

HamletDRC2
> This is trivial bytecode shortcut for creating array out of objects on
> top of stack What's wrong with it?


The problem is that people don't understand why it exists, how it was created, or where it is used. If you saw this source file in a typical enterprise application then you would probably go find the developer responsible and ask some questions because there are easier ways (from user code) to manipulate Arrays. I'm sorry I tweeted about this file. What a pointless mess I needlessly created.

--
Hamlet D'Arcy
[hidden email]

----- Original Message -----

> This is trivial bytecode shortcut for creating array out of objects on
> top of stack What's wrong with it?
>
> On Tue, Nov 30, 2010 at 4:37 AM, Behrang Saeedzadeh
> <[hidden email]> wrote:
> > Hi all,
> >
> > Something seems to be wrong here:
> >
> > http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/main/org/codehaus/groovy/runtime/ArrayUtil.java
> >
> > Any ideas what's going on here?
> >
> > Cheers,
> > Behrang Saeedzadeh
> > http://www.behrang.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Guys, any explanations about this?

johnrellis
It was a good explanation, let this sleeping dog lie :) I found it interesting not scary! 

On Tue, Nov 30, 2010 at 9:13 AM, Hamlet DArcy <[hidden email]> wrote:
> This is trivial bytecode shortcut for creating array out of objects on
> top of stack What's wrong with it?


The problem is that people don't understand why it exists, how it was created, or where it is used. If you saw this source file in a typical enterprise application then you would probably go find the developer responsible and ask some questions because there are easier ways (from user code) to manipulate Arrays. I'm sorry I tweeted about this file. What a pointless mess I needlessly created.

--
Hamlet D'Arcy
[hidden email]

----- Original Message -----
> This is trivial bytecode shortcut for creating array out of objects on
> top of stack What's wrong with it?
>
> On Tue, Nov 30, 2010 at 4:37 AM, Behrang Saeedzadeh
> <[hidden email]> wrote:
> > Hi all,
> >
> > Something seems to be wrong here:
> >
> > http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/main/org/codehaus/groovy/runtime/ArrayUtil.java
> >
> > Any ideas what's going on here?
> >
> > Cheers,
> > Behrang Saeedzadeh
> > http://www.behrang.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
John Rellis
@johnrellis

Reply | Threaded
Open this post in threaded view
|

Re: Guys, any explanations about this?

Alex Tkachman
In reply to this post by HamletDRC2
No problem, Hamlet. I think we have much more intriguing pieces of
code. ACG, for example, or ClassInfo. Not to mention MCI, EMC and
around. If someone asks what we do in let say ClassInfo and
synchronize here but not there... you know it is an interesting
discussion.

BTW, if you want some real challenge - read ClassInfo. I am (almost)
sure we have deep synchronization bug somewhere around. I saw recently
several reports on deadlock which makes me think so. Some fresh eye
reading might help.

On Tue, Nov 30, 2010 at 11:13 AM, Hamlet DArcy <[hidden email]> wrote:

>> This is trivial bytecode shortcut for creating array out of objects on
>> top of stack What's wrong with it?
>
>
> The problem is that people don't understand why it exists, how it was created, or where it is used. If you saw this source file in a typical enterprise application then you would probably go find the developer responsible and ask some questions because there are easier ways (from user code) to manipulate Arrays. I'm sorry I tweeted about this file. What a pointless mess I needlessly created.
>
> --
> Hamlet D'Arcy
> [hidden email]
>
> ----- Original Message -----
>> This is trivial bytecode shortcut for creating array out of objects on
>> top of stack What's wrong with it?
>>
>> On Tue, Nov 30, 2010 at 4:37 AM, Behrang Saeedzadeh
>> <[hidden email]> wrote:
>> > Hi all,
>> >
>> > Something seems to be wrong here:
>> >
>> > http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/main/org/codehaus/groovy/runtime/ArrayUtil.java
>> >
>> > Any ideas what's going on here?
>> >
>> > Cheers,
>> > Behrang Saeedzadeh
>> > http://www.behrang.org
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>> http://xircles.codehaus.org/manage_email
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Guys, any explanations about this?

Mikhail Antonov
Interesting topic - thanks for useful answers!

Alex, I have one idea about what you have said "Some fresh eye reading might help"
I think there are quite a lot of experienced and skillful java developers starting trying Groovy... And Groovy itself is written in Java.

So, when you guys who develop groovy core have some particular place (at package / several class level probably) then you can just publish that on groovy site and post here. Something like:

Following piece of code probably has a bug and needs to be reviewed. So we start a contest :) first one who described correctly what the bug is (if it is) will be..you know.. winner of that contest :)

This way you may involve more developers into that reviews, just making that some sort of programming competition.

What do you think?

Thanks,
Michael



2010/11/30 Alex Tkachman <[hidden email]>
No problem, Hamlet. I think we have much more intriguing pieces of
code. ACG, for example, or ClassInfo. Not to mention MCI, EMC and
around. If someone asks what we do in let say ClassInfo and
synchronize here but not there... you know it is an interesting
discussion.

BTW, if you want some real challenge - read ClassInfo. I am (almost)
sure we have deep synchronization bug somewhere around. I saw recently
several reports on deadlock which makes me think so. Some fresh eye
reading might help.

On Tue, Nov 30, 2010 at 11:13 AM, Hamlet DArcy <[hidden email]> wrote:
>> This is trivial bytecode shortcut for creating array out of objects on
>> top of stack What's wrong with it?
>
>
> The problem is that people don't understand why it exists, how it was created, or where it is used. If you saw this source file in a typical enterprise application then you would probably go find the developer responsible and ask some questions because there are easier ways (from user code) to manipulate Arrays. I'm sorry I tweeted about this file. What a pointless mess I needlessly created.
>
> --
> Hamlet D'Arcy
> [hidden email]
>
> ----- Original Message -----
>> This is trivial bytecode shortcut for creating array out of objects on
>> top of stack What's wrong with it?
>>
>> On Tue, Nov 30, 2010 at 4:37 AM, Behrang Saeedzadeh
>> <[hidden email]> wrote:
>> > Hi all,
>> >
>> > Something seems to be wrong here:
>> >
>> > http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/main/org/codehaus/groovy/runtime/ArrayUtil.java
>> >
>> > Any ideas what's going on here?
>> >
>> > Cheers,
>> > Behrang Saeedzadeh
>> > http://www.behrang.org
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>> http://xircles.codehaus.org/manage_email
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Thanks,
Michael Antonov

Reply | Threaded
Open this post in threaded view
|

Re: Guys, any explanations about this?

HamletDRC2
>> What do you think?  

It is an open source project. Write a small grails/gaelyk app that subsscribes to the Groovy-SCM mailing list and displays all the changed files in the last 7 days. Offer a small reward for anyone submitting a failing test case against any of these files.

The ball is in your court. :)

--
Hamlet D'Arcy
[hidden email]

----- Original Message -----



Interesting topic - thanks for useful answers!


Alex , I have one idea about what you have said "Some fresh eye reading might help"
I think there are quite a lot of experienced and skillful java developers starting trying Groovy... And Groovy itself is written in Java.


So, when you guys who develop groovy core have some particular place (at package / several class level probably) then you can just publish that on groovy site and post here. Something like:


Following piece of code probably has a bug and needs to be reviewed. So we start a contest :) first one who described correctly what the bug is (if it is) will be..you know.. winner of that contest :)


This way you may involve more developers into that reviews, just making that some sort of programming competition.


What do you think?


Thanks,
Michael




2010/11/30 Alex Tkachman < [hidden email] >


No problem, Hamlet. I think we have much more intriguing pieces of
code. ACG, for example, or ClassInfo. Not to mention MCI, EMC and
around. If someone asks what we do in let say ClassInfo and
synchronize here but not there... you know it is an interesting
discussion.

BTW, if you want some real challenge - read ClassInfo. I am (almost)
sure we have deep synchronization bug somewhere around. I saw recently
several reports on deadlock which makes me think so. Some fresh eye
reading might help.




On Tue, Nov 30, 2010 at 11:13 AM, Hamlet DArcy < [hidden email] > wrote:

>> This is trivial bytecode shortcut for creating array out of objects on
>> top of stack What's wrong with it?
>
>
> The problem is that people don't understand why it exists, how it was created, or where it is used. If you saw this source file in a typical enterprise application then you would probably go find the developer responsible and ask some questions because there are easier ways (from user code) to manipulate Arrays. I'm sorry I tweeted about this file. What a pointless mess I needlessly created.
>
> --
> Hamlet D'Arcy
> [hidden email]
>
> ----- Original Message -----
>> This is trivial bytecode shortcut for creating array out of objects on
>> top of stack What's wrong with it?
>>
>> On Tue, Nov 30, 2010 at 4:37 AM, Behrang Saeedzadeh
>> < [hidden email] > wrote:
>> > Hi all,
>> >
>> > Something seems to be wrong here:
>> >
>> > http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/main/org/codehaus/groovy/runtime/ArrayUtil.java 
>> >
>> > Any ideas what's going on here?
>> >
>> > Cheers,
>> > Behrang Saeedzadeh
>> > http://www.behrang.org 
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>> http://xircles.codehaus.org/manage_email 
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email 
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email 





--
Thanks,
Michael Antonov


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Guys, any explanations about this?

Jochen Theodorou
In reply to this post by Mikhail Antonov
Михаил Антонов wrote:
[...]
> Following piece of code probably has a bug and needs to be reviewed. So
> we start a contest :) first one who described correctly what the bug is
> (if it is) will be..you know.. winner of that contest :)
>
> This way you may involve more developers into that reviews, just making
> that some sort of programming competition.
>
> What do you think?

basically a good idea, but doesn't "following piece of code probably has
a bug and needs to be reviewed" potentially apply to each and every code
file?

bye blackdrag
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead
http://blackdragsview.blogspot.com/
For Groovy programming sources visit http://groovy.codehaus.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Guys, any explanations about this?

Mikhail Antonov
I meant actually, that some groovy core developers identify such places where the possibility of a bug is highest.

For example above if was mentioned that there could be a deep sync. bug in a particular place (whereas, in other places there could be also bugs, but the possibility is much lower).

My main idea is, let me restate in another words: there are groovy core developers, who know most about that groovy codebase. And they know that there are some most suspicious places in the code in terms of potential bugs. And you guys want fresh eyes to see that.

Well, play with the people natural here :) -- make finding bugs and reviewing code a contest! People spend time on TopCoder as this is a contest.

So, why not you try that this way: ok, here is a code in ACG which likely contains a bug, we ourselves don't know, but we just have a gutfeeling. So, first who discover it will be placed at the wall of shame (damn, wall of fame I should  have said :)))) on the groovy site.

That is.

Thanks,
Michael

2010/11/30 Jochen Theodorou <[hidden email]>
Михаил Антонов wrote:
[...]

Following piece of code probably has a bug and needs to be reviewed. So we start a contest :) first one who described correctly what the bug is (if it is) will be..you know.. winner of that contest :)

This way you may involve more developers into that reviews, just making that some sort of programming competition.

What do you think?

basically a good idea, but doesn't "following piece of code probably has a bug and needs to be reviewed" potentially apply to each and every code file?

bye blackdrag
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead
http://blackdragsview.blogspot.com/
For Groovy programming sources visit http://groovy.codehaus.org



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email





--
Thanks,
Michael Antonov

123