Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   How to get from A to B (actually, from type "A" to type "B") (http://www.velocityreviews.com/forums/t956214-how-to-get-from-a-to-b-actually-from-type-a-to-type-b.html)

Ramon F. Herrera 01-06-2013 07:22 PM

How to get from A to B (actually, from type "A" to type "B")
 
I was flabbergasted the first time I used an IDE that had the "period
completion" feature (or the similar, "left parenthesis"). It made me
considering leaving old trusted "vi".

The problem with the period is that it only goes one step deep: more
steps are needed! Additionally, sometimes the period is not the answer
to your travails, when a non-member function is the one that will
convert from type "A" to type "B".

When I was learning Java, a large number of questions (and time
wasted) that I posted were of the form:

"How do I convert [some type] to [some other type]?"

The text conversions alone occupy an inordinate amount of time to
programmers (just try Google to see what I mean).

Some C++ examples:

I had been using for a long time this (from Boost::Filesystem):

string somestring = "abc/de";
path p = path(somestring);

Only to realize, accidentally, that the conversion is done
automatically. The IDE should help you in those cases:

path p = somestring;

This one made me kick myself. I used this many, many times:

const char* sometext = somestring.string().c_str();

Well, it turns out that this one is just as good:

const char* sometext = somestring.c_str();

My question is about R&D done in this particular field. I tried Google
but the word "type" is too ambiguous.

This problem is very similar to the resolution of Rubik's Cube. Your
expression is in some "scrambled" state and you need the computer to
tell you -not only any path! mind you- but the shortest path (known as
God's algorithm) to the desired type. Exhaustive, aka brute force
search can be used: after all, we are not talking Rubik type of steps,
most of the time we are 1 or 2 steps away from the conversion.

Regards,

-Ramon

Ramon F Herrera 01-06-2013 07:27 PM

Re: How to get from A to B (actually, from type "A" to type "B")
 

Correction:

const char* sometext = p.string().c_str();

-RFH


Aryeh M. Friedman 01-06-2013 07:31 PM

Re: How to get from A to B (actually, from type "A" to type "B")
 
On Sunday, January 6, 2013 2:22:55 PM UTC-5, Ramon F Herrera wrote:
> I was flabbergasted the first time I used an IDE that had the "period
>
> completion" feature (or the similar, "left parenthesis"). It made me
>
> considering leaving old trusted "vi".
>
>
>
> The problem with the period is that it only goes one step deep: more
>
> steps are needed! Additionally, sometimes the period is not the answer
>
> to your travails, when a non-member function is the one that will
>
> convert from type "A" to type "B".
>
>
>
> When I was learning Java, a large number of questions (and time
>
> wasted) that I posted were of the form:
>
>
>
> "How do I convert [some type] to [some other type]?"
>
>
>
> The text conversions alone occupy an inordinate amount of time to
>
> programmers (just try Google to see what I mean).
>
>
>
> Some C++ examples:
>
>
>
> I had been using for a long time this (from Boost::Filesystem):
>
>
>
> string somestring = "abc/de";
>
> path p = path(somestring);
>
>
>
> Only to realize, accidentally, that the conversion is done
>
> automatically. The IDE should help you in those cases:
>
>
>
> path p = somestring;
>
>
>
> This one made me kick myself. I used this many, many times:
>
>
>
> const char* sometext = somestring.string().c_str();
>
>
>
> Well, it turns out that this one is just as good:
>
>
>
> const char* sometext = somestring.c_str();
>
>
>
> My question is about R&D done in this particular field. I tried Google
>
> but the word "type" is too ambiguous.
>
>
>
> This problem is very similar to the resolution of Rubik's Cube. Your
>
> expression is in some "scrambled" state and you need the computer to
>
> tell you -not only any path! mind you- but the shortest path (known as
>
> God's algorithm) to the desired type. Exhaustive, aka brute force
>
> search can be used: after all, we are not talking Rubik type of steps,
>
> most of the time we are 1 or 2 steps away from the conversion.
>
>
>
> Regards,
>
>
>
> -Ramon


whats your point/question?

Ramon F Herrera 01-06-2013 07:42 PM

Re: How to get from A to B (actually, from type "A" to type "B")
 
On Jan 6, 1:31*pm, "Aryeh M. Friedman" <Aryeh.Fried...@gmail.com>
wrote:

> whats your point/question?


It is an open question, to feed my curiosity. I had this post in mind
for years, it's not like I am under a deadline or anything.

Folks could comment, for instance that the period features fails more
often than it works on MSVS-2005 but with the addition of "dependent
includes" in MSVS-2010 the situation has improved.

I have not used Eclipse or JavaBeans for years, but it was there were
I first discovered the period.

Maybe Java lends itself more to the implementation of this type of
feature?

-Ramon


Ramon F Herrera 01-06-2013 07:58 PM

Re: How to get from A to B (actually, from type "A" to type "B")
 
On Jan 6, 1:31*pm, "Aryeh M. Friedman" <Aryeh.Fried...@gmail.com>
wrote:

> whats your point/question?


Part of the question is about research, I am just curious to see what
is being done about this glaringly obvious need.

I tried to find some sci.research.comp comp.sci.research or similar
newsgroup, but apparently there is no such thing in Usenet!

I found this one, outside:

http://www.scienceforums.net/topic/7...e-a-to-type-b/

Which brings me back to the point! (pun intended): If the Google folks
are so smart how come they don't have a facility to explore the Usenet
forums? I would type:

comp [followed by a dot]

and the children NGs would appear.

I believe that Google Groups has gone out of its way to block this
type of concise perusal.

-Ramon

Arne Vajh°j 01-06-2013 08:04 PM

Re: How to get from A to B (actually, from type "A" to type "B")
 
On 1/6/2013 2:22 PM, Ramon F. Herrera wrote:
> I was flabbergasted the first time I used an IDE that had the "period
> completion" feature (or the similar, "left parenthesis"). It made me
> considering leaving old trusted "vi".
>
> The problem with the period is that it only goes one step deep: more
> steps are needed! Additionally, sometimes the period is not the answer
> to your travails, when a non-member function is the one that will
> convert from type "A" to type "B".
>
> When I was learning Java, a large number of questions (and time
> wasted) that I posted were of the form:
>
> "How do I convert [some type] to [some other type]?"
>
> The text conversions alone occupy an inordinate amount of time to
> programmers (just try Google to see what I mean).
>
> Some C++ examples:
>
> I had been using for a long time this (from Boost::Filesystem):
>
> string somestring = "abc/de";
> path p = path(somestring);
>
> Only to realize, accidentally, that the conversion is done
> automatically. The IDE should help you in those cases:
>
> path p = somestring;
>
> This one made me kick myself. I used this many, many times:
>
> const char* sometext = somestring.string().c_str();
>
> Well, it turns out that this one is just as good:
>
> const char* sometext = somestring.c_str();
>
> My question is about R&D done in this particular field. I tried Google
> but the word "type" is too ambiguous.
>
> This problem is very similar to the resolution of Rubik's Cube. Your
> expression is in some "scrambled" state and you need the computer to
> tell you -not only any path! mind you- but the shortest path (known as
> God's algorithm) to the desired type. Exhaustive, aka brute force
> search can be used: after all, we are not talking Rubik type of steps,
> most of the time we are 1 or 2 steps away from the conversion.


I don't think there is much science in this.

You learn and remember the most common conversions as
you learn language and associated libraries.

You learn to find the uncommon conversions in the
documentation when you need them.

Arne



Ramon F Herrera 01-06-2013 08:05 PM

Re: How to get from A to B (actually, from type "A" to type "B")
 
On Jan 6, 2:04*pm, Arne Vajh°j <a...@vajhoej.dk> wrote:

> I don't think there is much science in this.
>
> You learn and remember the most common conversions as
> you learn language and associated libraries.
>
> You learn to find the uncommon conversions in the
> documentation when you need them.
>
> Arne


You should definitely watch this:

http://www.youtube.com/watch?v=OC3qFtgeogE&noredirect=1

-Ramon


Arne Vajh°j 01-06-2013 08:06 PM

Re: How to get from A to B (actually, from type "A" to type "B")
 
On 1/6/2013 2:42 PM, Ramon F Herrera wrote:
> On Jan 6, 1:31 pm, "Aryeh M. Friedman" <Aryeh.Fried...@gmail.com>
> wrote:
>
> > whats your point/question?

>
> It is an open question, to feed my curiosity. I had this post in mind
> for years, it's not like I am under a deadline or anything.
>
> Folks could comment, for instance that the period features fails more
> often than it works on MSVS-2005 but with the addition of "dependent
> includes" in MSVS-2010 the situation has improved.
>
> I have not used Eclipse or JavaBeans for years, but it was there were
> I first discovered the period.
>
> Maybe Java lends itself more to the implementation of this type of
> feature?


I doubt it.

The only relevant difference I can think of is that Java
does not support user defined casts.

Arne



Arne Vajh°j 01-06-2013 08:08 PM

Re: How to get from A to B (actually, from type "A" to type "B")
 
On 1/6/2013 2:58 PM, Ramon F Herrera wrote:
> On Jan 6, 1:31 pm, "Aryeh M. Friedman" <Aryeh.Fried...@gmail.com>
> wrote:
>
> > whats your point/question?

>
> Part of the question is about research, I am just curious to see what
> is being done about this glaringly obvious need.
>
> I tried to find some sci.research.comp comp.sci.research or similar
> newsgroup, but apparently there is no such thing in Usenet!
>
> I found this one, outside:
>
> http://www.scienceforums.net/topic/7...e-a-to-type-b/


You may be able to find a group where desirable features for
new languages are discussed, but for existing languages the choices
has been made.

> Which brings me back to the point! (pun intended): If the Google folks
> are so smart how come they don't have a facility to explore the Usenet
> forums? I would type:
>
> comp [followed by a dot]
>
> and the children NGs would appear.
>
> I believe that Google Groups has gone out of its way to block this
> type of concise perusal.


This is a client app thing - if Google expose an API, then you can
write such a client.

Arne



Arne Vajh°j 01-06-2013 08:10 PM

Re: How to get from A to B (actually, from type "A" to type "B")
 
On 1/6/2013 3:05 PM, Ramon F Herrera wrote:
> On Jan 6, 2:04 pm, Arne Vajh°j <a...@vajhoej.dk> wrote:
>
>> I don't think there is much science in this.
>>
>> You learn and remember the most common conversions as
>> you learn language and associated libraries.
>>
>> You learn to find the uncommon conversions in the
>> documentation when you need them.

>
> You should definitely watch this:
>
> http://www.youtube.com/watch?v=OC3qFtgeogE&noredirect=1


Why?

He did not write code. Wozniak did.

Arne




All times are GMT. The time now is 02:59 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.