Static methods - please!

The use of specific JADE features and proposals for new feature suggestions
allistar
Posts: 156
Joined: Fri Aug 14, 2009 11:02 am
Location: Mount Maunganui, Tauranga

Static methods - please!

Postby allistar » Wed Sep 17, 2014 11:38 am

The subject says it all. Static methods is a core part of most popular OO languages. What is needed is a new method modifier like this:

someMethod():String static;

Then this can be invoked like this:

value := SomeClass.someMethod();

or on an instance:

value := instanceOfSomeClass.someMethod();

We can already do something similar with class constants. The method would need to prevent access to member properties on the class (similar to how conditions limit what can be accessed), but we should be able to access global variables like app.

Workarounds for the lack of static methods tend to be nasty. Creating transient instances of the class is one approach, but that doesn't work if the class is abstract and it's not very efficient.

What will it take for this staple OO feature to make it's way into the JADE language? Come on guys!

User avatar
suzuki1100
Posts: 29
Joined: Tue Nov 24, 2009 12:00 pm
Location: Auckland

Re: Static methods - please!

Postby suzuki1100 » Thu Sep 18, 2014 5:27 pm

+100

Fully agree and I dislike having to create a transient object to access a method that should be a static method.
Gets even more revolting when performance is an issue and you end up having to store collections of transients to provide static methods.

Stokes
Posts: 66
Joined: Wed Oct 13, 2010 2:06 pm
Location: QLD, Australia

Re: Static methods - please!

Postby Stokes » Fri Sep 19, 2014 3:56 am

Yes please - creating transients to access a method is messy

User avatar
suzuki1100
Posts: 29
Joined: Tue Nov 24, 2009 12:00 pm
Location: Auckland

Re: Static methods - please!

Postby suzuki1100 » Thu Oct 02, 2014 5:23 pm

We have 3 Jade developers interested in Static methods surely there are others !!!

Please post your support for this feature

User avatar
BeeJay
Posts: 312
Joined: Tue Jun 30, 2009 2:42 pm
Location: Christchurch, NZ

Re: Static methods - please!

Postby BeeJay » Thu Oct 02, 2014 10:02 pm

Interestingly I've never really felt hamstrung by the lack of static methods in Jade. Maybe it's because of the type of systems I've worked on, or the nature of the underlying architecture of those systems, that has meant that I'm never really crying out for static methods very often?!?

I find the same thing happens when people start talking about the lack of method overloading, or the lack of parameterised constructors, being a major issue for them when working in Jade. Again, perhaps it's just that I've been working without them in Jade for so long that I don't miss them, or it's to do with the underlying architecture of the systems I've worked on being designed with those 'limitations' in mind that they never show up regularly as being an issue for me?

You can still put me down as another +1 for having static methods, I probably won't end up using them very often but on the odd occasion I do I'll enjoy having them available and who knows, once they are available maybe I'll start to see more opportunities to use them. ;)

Cheers,
BeeJay.

User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

Re: Static methods - please!

Postby ghosttie » Fri Oct 03, 2014 1:45 am

I'd like static methods, I just don't think we'll get them.
I have a catapult. Give me all the money or I will fling an enormous rock at your head.

User avatar
Dr Danyo
Posts: 56
Joined: Fri Aug 21, 2009 8:59 am

Re: Static methods - please!

Postby Dr Danyo » Fri Oct 03, 2014 11:49 pm

Im inclined to agree with BeeJay regarding static methods, nice to have and if it was there I would use it.

However top of my wish list is parameterised constructors, I would be using those consistently if they existed. Being able to create an object and initialize it in a single step (subsequently making it immutable if all properties were protected) would be a great benefit in my mind. Still doable without parameterised constructors, but I always end up writing much more boiler plate then I would like.

- Dr Danyo.

User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

Re: Static methods - please!

Postby ghosttie » Sat Oct 04, 2014 1:14 am

However top of my wish list is parameterised constructors, I would be using those consistently if they existed. Being able to create an object and initialize it in a single step (subsequently making it immutable if all properties were protected) would be a great benefit in my mind. Still doable without parameterised constructors, but I always end up writing much more boiler plate then I would like.
+1
I have a catapult. Give me all the money or I will fling an enormous rock at your head.

User avatar
suzuki1100
Posts: 29
Joined: Tue Nov 24, 2009 12:00 pm
Location: Auckland

Re: Static methods - please!

Postby suzuki1100 » Sat Oct 04, 2014 7:10 pm

Agreed +1
After static methods as technically they should be easy for Jade to implement

davidmellow
Posts: 42
Joined: Thu Aug 27, 2009 1:27 pm
Location: New Plymouth, New Zealand

Re: Static methods - please!

Postby davidmellow » Mon Oct 13, 2014 12:59 pm

Definitely a vote here for static methods, and I miss both method overloading and parameterised constructors also.

Interesting reading the variety of opinions regarding each, but for me the lack of method overloading is perhaps what frustrates the most.

Cheers.


Return to “Feature Discussions”

Who is online

Users browsing this forum: No registered users and 10 guests

cron