Survey: Changing method names in JNIPort?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Survey: Changing method names in JNIPort?

Joachim Geidel
Hello everybody!

I am preparing to port JNIPort (the Smalltalk-to-Java interface) to Squeak
and Pharo. However, there is a complication: Squeak and Pharo don't accept
underscores in method names, while Dolphin and VisualWorks have no problem
with underscores. JNIPort contains many methods with underscores.

If you are a JNIPort user, I would like to hear what you think about the
ways to solve this problem. Opinions from non-users are welcome, too, of
course.

I currently see two options:

1. I can keep the versions for all platforms in sync. Obviously, I would
prefer this solution, as it is less work for me. On the other hand, users of
JNIPort would have to get used to new naming conventions:

- All underscores would be dropped from method names. As method names for
generated methods include the type names of the arguments, this can lead to
somewhat ugly looking names, as the usual camel case notation is not
necessarily respected. E.g.,
    get_int: would be replaced by getint:
    get_Object:String: would be replaced by getObject:String:
In those simple cases, the new notation doesn't look much worse than before.

- Static fields in Java tend to have uppercase names with underscores, which
I would have to drop, too:
    get_MAX_VALUE  -> getMAXVALUE
    set_MAX_VALUE: -> setMAXVALUE:
This has a small potential for naming conflicts if two field names in the
same class differ only by underscores. But you can always use lower level
methods for accessing a field if the generated method is ambiguous.

- For names of inner classes which contain a $ character, I can't replace $
by _ anymore, and would use 0 (zero) instead - it doesn't look much worse
than the $ character in Java, and I can't come up with something nicer which
is a legal character in a selector.

2. I could leave the VisualWorks version as it is, and maintain a second
code branch for Squeak and Pharo. I don't like this solution, as it means
more work for me. For JNIPort users, it would mean that their code isn't
easily portable to Squeak. OTOH, it would preserve the current more-or-less
nice-looking method names in generated classes.

So, what do you think?

Joachim Geidel


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Survey: Changing method names in JNIPort?

Tudor Girba
Hi Joachim,

As far as I know, Pharo now supports underscores in method names. Am I  
wrong?

Cheers,
Doru


On 8 May 2010, at 21:31, Joachim Geidel wrote:

> Hello everybody!
>
> I am preparing to port JNIPort (the Smalltalk-to-Java interface) to  
> Squeak
> and Pharo. However, there is a complication: Squeak and Pharo don't  
> accept
> underscores in method names, while Dolphin and VisualWorks have no  
> problem
> with underscores. JNIPort contains many methods with underscores.
>
> If you are a JNIPort user, I would like to hear what you think about  
> the
> ways to solve this problem. Opinions from non-users are welcome,  
> too, of
> course.
>
> I currently see two options:
>
> 1. I can keep the versions for all platforms in sync. Obviously, I  
> would
> prefer this solution, as it is less work for me. On the other hand,  
> users of
> JNIPort would have to get used to new naming conventions:
>
> - All underscores would be dropped from method names. As method  
> names for
> generated methods include the type names of the arguments, this can  
> lead to
> somewhat ugly looking names, as the usual camel case notation is not
> necessarily respected. E.g.,
>    get_int: would be replaced by getint:
>    get_Object:String: would be replaced by getObject:String:
> In those simple cases, the new notation doesn't look much worse than  
> before.
>
> - Static fields in Java tend to have uppercase names with  
> underscores, which
> I would have to drop, too:
>    get_MAX_VALUE  -> getMAXVALUE
>    set_MAX_VALUE: -> setMAXVALUE:
> This has a small potential for naming conflicts if two field names  
> in the
> same class differ only by underscores. But you can always use lower  
> level
> methods for accessing a field if the generated method is ambiguous.
>
> - For names of inner classes which contain a $ character, I can't  
> replace $
> by _ anymore, and would use 0 (zero) instead - it doesn't look much  
> worse
> than the $ character in Java, and I can't come up with something  
> nicer which
> is a legal character in a selector.
>
> 2. I could leave the VisualWorks version as it is, and maintain a  
> second
> code branch for Squeak and Pharo. I don't like this solution, as it  
> means
> more work for me. For JNIPort users, it would mean that their code  
> isn't
> easily portable to Squeak. OTOH, it would preserve the current more-
> or-less
> nice-looking method names in generated classes.
>
> So, what do you think?
>
> Joachim Geidel
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

--
www.tudorgirba.com

"Sometimes the best solution is not the best solution."

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Survey: Changing method names in JNIPort?

stephane ducasse-2
In reply to this post by Joachim Geidel

On May 8, 2010, at 9:31 PM, Joachim Geidel wrote:

> Hello everybody!
>
> I am preparing to port JNIPort (the Smalltalk-to-Java interface) to Squeak
> and Pharo. However, there is a complication: Squeak and Pharo don't accept
> underscores in method names,

Pharo does...

> while Dolphin and VisualWorks have no problem
> with underscores. JNIPort contains many methods with underscores.
>
> If you are a JNIPort user, I would like to hear what you think about the
> ways to solve this problem. Opinions from non-users are welcome, too, of
> course.
>
> I currently see two options:
>
> 1. I can keep the versions for all platforms in sync. Obviously, I would
> prefer this solution, as it is less work for me. On the other hand, users of
> JNIPort would have to get used to new naming conventions:
>
> - All underscores would be dropped from method names. As method names for
> generated methods include the type names of the arguments, this can lead to
> somewhat ugly looking names, as the usual camel case notation is not
> necessarily respected. E.g.,
>    get_int: would be replaced by getint:
>    get_Object:String: would be replaced by getObject:String:
> In those simple cases, the new notation doesn't look much worse than before.
>
> - Static fields in Java tend to have uppercase names with underscores, which
> I would have to drop, too:
>    get_MAX_VALUE  -> getMAXVALUE
>    set_MAX_VALUE: -> setMAXVALUE:
> This has a small potential for naming conflicts if two field names in the
> same class differ only by underscores. But you can always use lower level
> methods for accessing a field if the generated method is ambiguous.
>
> - For names of inner classes which contain a $ character, I can't replace $
> by _ anymore, and would use 0 (zero) instead - it doesn't look much worse
> than the $ character in Java, and I can't come up with something nicer which
> is a legal character in a selector.
>
> 2. I could leave the VisualWorks version as it is, and maintain a second
> code branch for Squeak and Pharo. I don't like this solution, as it means
> more work for me. For JNIPort users, it would mean that their code isn't
> easily portable to Squeak. OTOH, it would preserve the current more-or-less
> nice-looking method names in generated classes.
>
> So, what do you think?
>
> Joachim Geidel
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Survey: Changing method names in JNIPort?

Joachim Geidel
Hi Stef,

Am 08.05.10 21:39 schrieb stephane ducasse:
>> I am preparing to port JNIPort (the Smalltalk-to-Java interface) to Squeak
>> and Pharo. However, there is a complication: Squeak and Pharo don't accept
>> underscores in method names,
>
> Pharo does...

I just tried to create a method named "a_b" in Pharo 1.0. This is what I
got:

    a Nothing more expected ->_b

Do I need a more recent version of Pharo?

Cheers,
Joachim Geidel


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Survey: Changing method names in JNIPort?

Mariano Martinez Peck
In reply to this post by stephane ducasse-2


On Sat, May 8, 2010 at 9:39 PM, stephane ducasse <[hidden email]> wrote:

On May 8, 2010, at 9:31 PM, Joachim Geidel wrote:

> Hello everybody!
>
> I am preparing to port JNIPort (the Smalltalk-to-Java interface) to Squeak
> and Pharo. However, there is a complication: Squeak and Pharo don't accept
> underscores in method names,

Pharo does...


 Only Pharo 1.1.

 

> while Dolphin and VisualWorks have no problem
> with underscores. JNIPort contains many methods with underscores.
>
> If you are a JNIPort user, I would like to hear what you think about the
> ways to solve this problem. Opinions from non-users are welcome, too, of
> course.
>
> I currently see two options:
>
> 1. I can keep the versions for all platforms in sync. Obviously, I would
> prefer this solution, as it is less work for me. On the other hand, users of
> JNIPort would have to get used to new naming conventions:
>
> - All underscores would be dropped from method names. As method names for
> generated methods include the type names of the arguments, this can lead to
> somewhat ugly looking names, as the usual camel case notation is not
> necessarily respected. E.g.,
>    get_int: would be replaced by getint:
>    get_Object:String: would be replaced by getObject:String:
> In those simple cases, the new notation doesn't look much worse than before.
>
> - Static fields in Java tend to have uppercase names with underscores, which
> I would have to drop, too:
>    get_MAX_VALUE  -> getMAXVALUE
>    set_MAX_VALUE: -> setMAXVALUE:
> This has a small potential for naming conflicts if two field names in the
> same class differ only by underscores. But you can always use lower level
> methods for accessing a field if the generated method is ambiguous.
>
> - For names of inner classes which contain a $ character, I can't replace $
> by _ anymore, and would use 0 (zero) instead - it doesn't look much worse
> than the $ character in Java, and I can't come up with something nicer which
> is a legal character in a selector.
>
> 2. I could leave the VisualWorks version as it is, and maintain a second
> code branch for Squeak and Pharo. I don't like this solution, as it means
> more work for me. For JNIPort users, it would mean that their code isn't
> easily portable to Squeak. OTOH, it would preserve the current more-or-less
> nice-looking method names in generated classes.
>
> So, what do you think?
>
> Joachim Geidel
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Survey: Changing method names in JNIPort?

stephane ducasse-2
1.1 soon in beta (15 of may)

On May 8, 2010, at 9:52 PM, Mariano Martinez Peck wrote:

>
>
> On Sat, May 8, 2010 at 9:39 PM, stephane ducasse <[hidden email]> wrote:
>
> On May 8, 2010, at 9:31 PM, Joachim Geidel wrote:
>
> > Hello everybody!
> >
> > I am preparing to port JNIPort (the Smalltalk-to-Java interface) to Squeak
> > and Pharo. However, there is a complication: Squeak and Pharo don't accept
> > underscores in method names,
>
> Pharo does...
>
>
>  Only Pharo 1.1.
>
>  
>
> > while Dolphin and VisualWorks have no problem
> > with underscores. JNIPort contains many methods with underscores.
> >
> > If you are a JNIPort user, I would like to hear what you think about the
> > ways to solve this problem. Opinions from non-users are welcome, too, of
> > course.
> >
> > I currently see two options:
> >
> > 1. I can keep the versions for all platforms in sync. Obviously, I would
> > prefer this solution, as it is less work for me. On the other hand, users of
> > JNIPort would have to get used to new naming conventions:
> >
> > - All underscores would be dropped from method names. As method names for
> > generated methods include the type names of the arguments, this can lead to
> > somewhat ugly looking names, as the usual camel case notation is not
> > necessarily respected. E.g.,
> >    get_int: would be replaced by getint:
> >    get_Object:String: would be replaced by getObject:String:
> > In those simple cases, the new notation doesn't look much worse than before.
> >
> > - Static fields in Java tend to have uppercase names with underscores, which
> > I would have to drop, too:
> >    get_MAX_VALUE  -> getMAXVALUE
> >    set_MAX_VALUE: -> setMAXVALUE:
> > This has a small potential for naming conflicts if two field names in the
> > same class differ only by underscores. But you can always use lower level
> > methods for accessing a field if the generated method is ambiguous.
> >
> > - For names of inner classes which contain a $ character, I can't replace $
> > by _ anymore, and would use 0 (zero) instead - it doesn't look much worse
> > than the $ character in Java, and I can't come up with something nicer which
> > is a legal character in a selector.
> >
> > 2. I could leave the VisualWorks version as it is, and maintain a second
> > code branch for Squeak and Pharo. I don't like this solution, as it means
> > more work for me. For JNIPort users, it would mean that their code isn't
> > easily portable to Squeak. OTOH, it would preserve the current more-or-less
> > nice-looking method names in generated classes.
> >
> > So, what do you think?
> >
> > Joachim Geidel
> >
> >
> > _______________________________________________
> > vwnc mailing list
> > [hidden email]
> > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Survey: Changing method names in JNIPort?

Joachim Geidel
Thanks for the info! I wasn't aware of the upcoming change in Pharo, and
didn't find information about it at pharo-project.org.

In the meantime, I also found that Squeak 4.1 supports underscores in
selectors if you enable a setting in the Preferences. It's a new feature
which was introduced in March. Not that I could find any documentation about
it - searching Squeak mailing list archives for references to "underscore"
was the way to find it. This cost me almost as much time as prototypically
rewriting JNIPort not to use underscores. I'll never again complain about
VisualWorks release notes! ;-)

So, I'll leave the underscores in JNIPort as they are. If any Squeak users
don't want to change the setting before loading JNIPort, then JNIPort won't
be for them, period.

The survey is cancelled. :-)

Best regards,
Joachim Geidel

Am 08.05.10 22:09 schrieb stephane ducasse:

> 1.1 soon in beta (15 of may)
>
> On May 8, 2010, at 9:52 PM, Mariano Martinez Peck wrote:
>
>>
>>
>> On Sat, May 8, 2010 at 9:39 PM, stephane ducasse <[hidden email]>
>> wrote:
>>
>> On May 8, 2010, at 9:31 PM, Joachim Geidel wrote:
>>
>>> Hello everybody!
>>>
>>> I am preparing to port JNIPort (the Smalltalk-to-Java interface) to Squeak
>>> and Pharo. However, there is a complication: Squeak and Pharo don't accept
>>> underscores in method names,
>>
>> Pharo does...
>>
>>
>>  Only Pharo 1.1.



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Survey: Changing method names in JNIPort?

Ernest Micklei
In reply to this post by Joachim Geidel
I would stick to using the underscores ; it emphasizes that a
"foreign" function is being called and what its exact name is.

One aspect I do not like is the postfix _null for zero argument
functions. I know about its reasoning but I wonder if JNIPort could be
changed such that it supports both versions (with and without _null).

On Sat, May 8, 2010 at 9:31 PM, Joachim Geidel
<[hidden email]> wrote:

> Hello everybody!
>
> I am preparing to port JNIPort (the Smalltalk-to-Java interface) to Squeak
> and Pharo. However, there is a complication: Squeak and Pharo don't accept
> underscores in method names, while Dolphin and VisualWorks have no problem
> with underscores. JNIPort contains many methods with underscores.
>
> If you are a JNIPort user, I would like to hear what you think about the
> ways to solve this problem. Opinions from non-users are welcome, too, of
> course.
>
> I currently see two options:
>
> 1. I can keep the versions for all platforms in sync. Obviously, I would
> prefer this solution, as it is less work for me. On the other hand, users of
> JNIPort would have to get used to new naming conventions:
>
> - All underscores would be dropped from method names. As method names for
> generated methods include the type names of the arguments, this can lead to
> somewhat ugly looking names, as the usual camel case notation is not
> necessarily respected. E.g.,
>    get_int: would be replaced by getint:
>    get_Object:String: would be replaced by getObject:String:
> In those simple cases, the new notation doesn't look much worse than before.
>
> - Static fields in Java tend to have uppercase names with underscores, which
> I would have to drop, too:
>    get_MAX_VALUE  -> getMAXVALUE
>    set_MAX_VALUE: -> setMAXVALUE:
> This has a small potential for naming conflicts if two field names in the
> same class differ only by underscores. But you can always use lower level
> methods for accessing a field if the generated method is ambiguous.
>
> - For names of inner classes which contain a $ character, I can't replace $
> by _ anymore, and would use 0 (zero) instead - it doesn't look much worse
> than the $ character in Java, and I can't come up with something nicer which
> is a legal character in a selector.
>
> 2. I could leave the VisualWorks version as it is, and maintain a second
> code branch for Squeak and Pharo. I don't like this solution, as it means
> more work for me. For JNIPort users, it would mean that their code isn't
> easily portable to Squeak. OTOH, it would preserve the current more-or-less
> nice-looking method names in generated classes.
>
> So, what do you think?
>
> Joachim Geidel
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>



--
^ Ernest Micklei

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Experience is the enemy of Creativity - Paul Arden
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Survey: Changing method names in JNIPort?

Joachim Geidel
Hi Ernest,

Am 10.05.10 11:39 schrieb Ernest Micklei:
> I would stick to using the underscores ; it emphasizes that a
> "foreign" function is being called and what its exact name is.

Yes, I'll keep the underscores, now that I found that both Pharo and Squeak
do/will accept them.

> One aspect I do not like is the postfix _null for zero argument
> functions. I know about its reasoning but I wonder if JNIPort could be
> changed such that it supports both versions (with and without _null).

I have already thrown out the _null postfix in my current work-in-progress
version. Supporting both versions won't work, but it's easy to change
existing code by using the Regular Expression Tool extension for the
Refactoring Browser.

Thanks!
Joachim


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc