Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

Method chaining for instance methods that return void

Thread view: 
Dmytro Sheyko - 18 Jan 2006 13:57 GMT
Hello all,

What do you think about this request for enhancement?

RFE: Method chaining for instance methods that return void
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6373386

Regards,
Dmytro Sheyko
Chris Uppal - 18 Jan 2006 15:42 GMT
> RFE: Method chaining for instance methods that return void
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6373386

Ugh!

I think that all future requests for changes to the language should be
accompanied by an irrevocable guarantee from the requester that he, she, or
they, would do the actual work of updating /all/ the tools that would be
affected by the change.  I.e. they would do the work of updating javac, they
would do the work of updating Eclipse, they would do the work of updating all
the hundreds of other tools out there which parse Java.

Beyond that, if you /are/ going to mess around with Java to support that idiom,
it would be /much/ better to support it properly.  There is nothing to stop you
defining a syntax that means "send this message to the receiver of the previous
message".  A parallel in Java of Smalltalk's "cascades" rather than the hacky,
restricted, and ugly "chaining" idiom.

   -- chris
Thomas Hawtin - 18 Jan 2006 22:16 GMT
> What do you think about this request for enhancement?
>
> RFE: Method chaining for instance methods that return void
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6373386

Many methods return values that programmers are unaware of. For
instance, remove methods may return a boolean to indicate something or
to return a previous value. That's going to make code using your
suggestion fail unexpectedly. Or in some case do things on an unexpected
object.

I don't like your chances of getting anything like this through. If
something were going to be introduced, I'd hope it'd go for a more
distinctive syntax, say:

    builder ->
        append("This "),
        append(stuff),
        append(".");

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/

Dmytro Sheyko - 19 Jan 2006 14:32 GMT
Thank you all for your responses.

> Hello all,
>
[quoted text clipped - 5 lines]
> Regards,
> Dmytro Sheyko


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.