alternative to void

44 views
Skip to first unread message

John Eisensmith

unread,
Nov 12, 2015, 4:22:57 AM11/12/15
to ceylon-dev
I just saw ceylon and loved this language especialy the syntax immediately.
However i have a suggestion to improve the language in things i hated in many years developing java.
What should i do with void/Void as a return type? I never understood the answer to this question.
I will expect from a new language like ceylon something like this:

class AClass {
 
self setMeIfYouCan(SomeTypeOf me) {
   
//do something
   
//and imlicitly return this
 
}
}

AClass ac = new AClass().setMeIfYouCan(SomeTypeOf.INSTANCE);



instead of:

class AClass {
 
void setMeIfYouCan(SomeTypeOf me) {
   
//do something
   
//and imlicitly return this
 
}
}

AClass ac = new AClass();
ac
.setMeIfYouCan(SomeTypeOf.INSTANCE);


Let me read your opinions about.

Bye

Tako Schotanus

unread,
Nov 12, 2015, 6:46:52 AM11/12/15
to ceylon-dev
Hi John,

there's actually an open issues about this, you could voice your support for it there:


Cheers,

-Tako

--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/c8265690-df58-40c1-b671-925e4055d002%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gavin King

unread,
Nov 12, 2015, 6:53:22 AM11/12/15
to ceylo...@googlegroups.com
*Very* early versions of the Ceylon language spec had an operator
named ^. which was for chaining void methods. But then I decided it
kinda went against the grain of using immutable objects and named
arguments instead of the builder pattern.

Also, unlike in Java, where setters are methods, it does not help
chain several attribute assignments. I think that's perhaps the
biggest reason it wouldn't help much in Ceylon.

That's not to say I'm hostile to this feature, just that I don't
perceive it as very necessary.
> --
> You received this message because you are subscribed to the Google Groups
> "ceylon-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ceylon-dev+...@googlegroups.com.
> To post to this group, send email to ceylo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ceylon-dev.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ceylon-dev/c8265690-df58-40c1-b671-925e4055d002%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Gavin King
ga...@ceylon-lang.org
http://profiles.google.com/gavin.king
http://ceylon-lang.org
http://hibernate.org
http://seamframework.org
Reply all
Reply to author
Forward
0 new messages