Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > java needs typedef

Reply
Thread Tools

java needs typedef

 
 
Steve Green
Guest
Posts: n/a
 
      03-24-2005
I was just doing a bit of coding for Java 1.5 and using generics; I am
rewriting an application I developed using the new features. I said it
before they implemented generics that they needed typedef and now that we
have generics I say again ... we need typedef ...

Which is really worse having to cast a return value on occasion or defining
HashMap<Key,Class> var = new HashMap<Key,Class>();

I try to use descriptive class names so they are longer than this.

We should be able to define an alias to Generic types.
For example:
typedef HashMap<Key,Class> MyHashMap;

Just a little frustrated,
Steve


 
Reply With Quote
 
 
 
 
AJ M.
Guest
Posts: n/a
 
      03-24-2005
dont be lazy. It is bad enough they added generics and autoboxing to Java.
It's beauty was in its simplicity.


"Steve Green" <(E-Mail Removed)> wrote in message
news:5Un0e.34298$FB6.12790@trndny09...
> I was just doing a bit of coding for Java 1.5 and using generics; I am
> rewriting an application I developed using the new features. I said it
> before they implemented generics that they needed typedef and now that we
> have generics I say again ... we need typedef ...
>
> Which is really worse having to cast a return value on occasion or

defining
> HashMap<Key,Class> var = new HashMap<Key,Class>();
>
> I try to use descriptive class names so they are longer than this.
>
> We should be able to define an alias to Generic types.
> For example:
> typedef HashMap<Key,Class> MyHashMap;
>
> Just a little frustrated,
> Steve
>
>



 
Reply With Quote
 
 
 
 
Jeff Schwab
Guest
Posts: n/a
 
      03-24-2005
AJ M. wrote:
> dont be lazy. It is bad enough they added generics and autoboxing to Java.
> It's beauty was in its simplicity.


I don't believe the issue is one of "laziness." It's one of clarity and
abstraction.

Of course, language changes are inherently Evil. What alternatives to
typedef are available already? I would appreciate suggestions from this
community. Why was typedef not brought into the language along with
generics?


> "Steve Green" <(E-Mail Removed)> wrote in message
> news:5Un0e.34298$FB6.12790@trndny09...
>
>>I was just doing a bit of coding for Java 1.5 and using generics; I am
>>rewriting an application I developed using the new features. I said it
>>before they implemented generics that they needed typedef and now that we
>>have generics I say again ... we need typedef ...
>>
>>Which is really worse having to cast a return value on occasion or

>
> defining
>
>>HashMap<Key,Class> var = new HashMap<Key,Class>();
>>
>>I try to use descriptive class names so they are longer than this.
>>
>>We should be able to define an alias to Generic types.
>>For example:
>>typedef HashMap<Key,Class> MyHashMap;
>>
>>Just a little frustrated,
>>Steve
>>
>>

>
>
>

 
Reply With Quote
 
Peter Rilling
Guest
Posts: n/a
 
      03-24-2005
I agree.

By the same logic as the original thread, one could say that any high level
language is also a matter of "laziness" when compared to assembly language.
No one certainly needs a language like C++ or Java or C# when it all gets
compiled/interpreted to machine code in the end.

I come from .NET and have just begun learning Java. Although some of the
constructs are different, .NET has come real conveniences that are working
their way into the Java world, and vis versa.

In the end, the evolution of software and languages make for a better
development environment where we are all more productive.

"Jeff Schwab" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> AJ M. wrote:
> > dont be lazy. It is bad enough they added generics and autoboxing to

Java.
> > It's beauty was in its simplicity.

>
> I don't believe the issue is one of "laziness." It's one of clarity and
> abstraction.
>
> Of course, language changes are inherently Evil. What alternatives to
> typedef are available already? I would appreciate suggestions from this
> community. Why was typedef not brought into the language along with
> generics?
>
>
> > "Steve Green" <(E-Mail Removed)> wrote in message
> > news:5Un0e.34298$FB6.12790@trndny09...
> >
> >>I was just doing a bit of coding for Java 1.5 and using generics; I am
> >>rewriting an application I developed using the new features. I said it
> >>before they implemented generics that they needed typedef and now that

we
> >>have generics I say again ... we need typedef ...
> >>
> >>Which is really worse having to cast a return value on occasion or

> >
> > defining
> >
> >>HashMap<Key,Class> var = new HashMap<Key,Class>();
> >>
> >>I try to use descriptive class names so they are longer than this.
> >>
> >>We should be able to define an alias to Generic types.
> >>For example:
> >>typedef HashMap<Key,Class> MyHashMap;
> >>
> >>Just a little frustrated,
> >>Steve
> >>
> >>

> >
> >
> >



 
Reply With Quote
 
Malte
Guest
Posts: n/a
 
      03-24-2005
AJ M. wrote:
>
> It's beauty was in its simplicity.
>

I totally agree.
 
Reply With Quote
 
Thomas Weidenfeller
Guest
Posts: n/a
 
      03-24-2005
AJ M. wrote:
> It's beauty was in its simplicity.


Yes, it was. And then they decided to add some pet syntax, because
<voice style="parody" type="old lady">
"it is so much nicer"
</voice>

All this has nothing to do with evolution of the state of the art. Java
has become part of the usual language "enhancement" cycle. A language is
"enhanced" up to the point were someone comes and says enough is enough
and creates something simpler. Then this new simpler language starts
being "enhanced" over time up to the point were it is at least as
complex as the predecessor. At that point yet another new simple
language comes up ...



/Thomas

--
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/...g/java/gui/faq
 
Reply With Quote
 
Tor Iver Wilhelmsen
Guest
Posts: n/a
 
      03-24-2005
"Steve Green" <(E-Mail Removed)> writes:

> HashMap<Key,Class> var = new HashMap<Key,Class>();


That is nothing. Using the wildcard variants for generics is the real
pain, and typedef won't help there.
 
Reply With Quote
 
Vincent Cantin
Guest
Posts: n/a
 
      03-25-2005
"Steve Green" <(E-Mail Removed)> glsD:5Un0e.34298$FB6.12790@trndny09...
>I was just doing a bit of coding for Java 1.5 and using generics; I am
>rewriting an application I developed using the new features. I said it
>before they implemented generics that they needed typedef and now that we
>have generics I say again ... we need typedef ...
>
> Which is really worse having to cast a return value on occasion or
> defining
> HashMap<Key,Class> var = new HashMap<Key,Class>();
>
> I try to use descriptive class names so they are longer than this.
>
> We should be able to define an alias to Generic types.
> For example:
> typedef HashMap<Key,Class> MyHashMap;
>
> Just a little frustrated,
> Steve


Instead of using typedef, just use inheritence :

public class MyHashMap extends HashMap<Key,Class>
{
}

... and that's it.

Vincent


 
Reply With Quote
 
Vincent Cantin
Guest
Posts: n/a
 
      03-25-2005

"Tor Iver Wilhelmsen" <(E-Mail Removed)>
???????:(E-Mail Removed)...
> "Steve Green" <(E-Mail Removed)> writes:
>
>> HashMap<Key,Class> var = new HashMap<Key,Class>();

>
> That is nothing. Using the wildcard variants for generics is the real
> pain, and typedef won't help there.


An example, please ?


 
Reply With Quote
 
Tim Tyler
Guest
Posts: n/a
 
      03-25-2005
AJ M. <(E-Mail Removed)> wrote or quoted:

> dont be lazy. It is bad enough they added generics and autoboxing to Java.
> It's beauty was in its simplicity.


Java was never simple.

In that respect it resembles English - full of
difficult-to-learn irregularities, and exceptions.

The designers chose to borrow from C++ rather than Smalltalk in that area.
--
__________
|im |yler http://timtyler.org/ http://www.velocityreviews.com/forums/(E-Mail Removed) Remove lock to reply.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VERY Urgent Direct Client Needs : 9 JAVA/J2EE (core JAVA) must hv expon Finance indstry. sarah Fernandes Java 0 03-09-2011 05:16 PM
CRTP-problem: How can the base class typedef a derived class' typedef? oor C++ 0 05-20-2008 12:39 PM
.NET not specifying namespace in web reply, but Java/Axis needs it PaulG Java 1 02-28-2004 05:42 PM
Non Java programmer needs help!! John Grogan Java 2 10-02-2003 09:13 AM
Newbie needs help with XML & Java Edu Java 1 08-08-2003 04:55 PM



Advertisments