FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

News: Helper methods for Strings and arrays

 
Post new topic   Reply to topic     Forum Index -> Tioport
View previous topic :: View next topic  
Author Message
keinfarbton



Joined: 03 Dec 2005
Posts: 224
Location: Stuttgart - Germany

PostPosted: Sat Apr 28, 2007 7:52 pm    Post subject: News: Helper methods for Strings and arrays Reply with quote

To make life easier, the generated sources now contain helper methods, that do call convertions function.

Every public method, which has a string or array argument or return type, will produce such a helper method. The helper methods name starts with "dh_". This should be the abreviation for "D Helper".

Some use of this is made in the wizard example.
Back to top
View user's profile Send private message
bobef



Joined: 05 Jun 2005
Posts: 269

PostPosted: Fri May 04, 2007 2:50 am    Post subject: Reply with quote

Is it possible to make the original method called jh_ like "Java helper" and our (D users) one to be called with it's normal name.

Like:

setText(char[])
jh_setText(String)

I guess then all other generated code will have to call the jh_ version, so I don't know if it is an easy task, but I have to ask Smile
Back to top
View user's profile Send private message
keinfarbton



Joined: 03 Dec 2005
Posts: 224
Location: Stuttgart - Germany

PostPosted: Fri May 04, 2007 3:13 am    Post subject: Reply with quote

I will give it a try.
Back to top
View user's profile Send private message
keinfarbton



Joined: 03 Dec 2005
Posts: 224
Location: Stuttgart - Germany

PostPosted: Sat May 05, 2007 1:57 pm    Post subject: Reply with quote

Hm, i don't like to change the original methods. The reason is, because D arrays are not the same as the Java variants are. I want them to be explicit named, showing that they are only wrappers around the original.

in D
Code:
setText( "" );
setText( null );

are equal. In Java they aren't.
Back to top
View user's profile Send private message
bobef



Joined: 05 Jun 2005
Posts: 269

PostPosted: Sat May 05, 2007 3:27 pm    Post subject: Reply with quote

Blah. I wish we had a nice overloadable global cast operator like in C++.
Something like:

Code:
String opCast(char[] a)
{return String.fromChar(a);}


Then (almost) none of that would be necessary....
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Tioport All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group