www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Idea for getting rid of "static" on methods

reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Nobody likes how overused static is, so here's an idea for a syntax to 
replace it in one place where it is frequently seen.

Here it goes:

    (with out this) int my_method() {...}

badum -ching!

--bb
Nov 30 2007
parent reply "Craig Black" <cblack ara.com> writes:
"Bill Baxter" <dnewsgroup billbaxter.com> wrote in message 
news:fipjds$cft$1 digitalmars.com...
 Nobody likes how overused static is, so here's an idea for a syntax to 
 replace it in one place where it is frequently seen.

 Here it goes:

    (with out this) int my_method() {...}

 badum -ching!

 --bb

What are you joking about? Did someone suggest getting rid of static?
Nov 30 2007
next sibling parent "Janice Caron" <caron800 googlemail.com> writes:
On 11/30/07, Craig Black <cblack ara.com> wrote:
 What are you joking about?

I'm sure he's joking. He's figured out that "with", "out" and "this" are all keywords, and when put together make a readable phrase. :) It's really quite clever, but I'd be surprised if it was a serious suggestion.
Nov 30 2007
prev sibling parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Craig Black wrote:
 "Bill Baxter" <dnewsgroup billbaxter.com> wrote in message 
 news:fipjds$cft$1 digitalmars.com...
 Nobody likes how overused static is, so here's an idea for a syntax to 
 replace it in one place where it is frequently seen.

 Here it goes:

    (with out this) int my_method() {...}

 badum -ching!

 --bb

What are you joking about? Did someone suggest getting rid of static?

Not recently, but it always comes up top on the list of confusingly overused keywords. I was just thinking about it a little because adding const(this) would kind of make static stick out. I was trying to think of some way static on methods could be made more parallel with const(this). Something like no(this) was the first thing that came to mind, but that's not a keyword so I went trolling through the keyword index to see if there was anything else suitable. But the best I could come up with sounded more like a feeble attempt at humor than a real solution. --bb
Nov 30 2007
parent reply Matti Niemenmaa <see_signature for.real.address> writes:
Bill Baxter wrote:
 Something like no(this) was the first thing that came to mind, but that's not
 a keyword so I went trolling through the keyword index to see if there was 
 anything else suitable.

How about: (!this) int my_method() {...} (!in this) int my_method() {...} (with !this) int my_method() {...} (!with this) int my_method() {...} (is !in this) int my_method() {...} (!is in this) int my_method() {...} (this !is in this) int my_method() {...} (this is !in this) int my_method() {...} Where in the latter two, the first 'this' of course refers to the method. -- E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi
Nov 30 2007
next sibling parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Matti Niemenmaa wrote:
 Bill Baxter wrote:
 Something like no(this) was the first thing that came to mind, but that's not
 a keyword so I went trolling through the keyword index to see if there was 
 anything else suitable.

How about: (!this) int my_method() {...} (!in this) int my_method() {...} (with !this) int my_method() {...} (!with this) int my_method() {...} (is !in this) int my_method() {...} (!is in this) int my_method() {...} (this !is in this) int my_method() {...} (this is !in this) int my_method() {...} Where in the latter two, the first 'this' of course refers to the method.

Now you're on to something! Just tweak that last one slightly: (this is !in function) int my_method() {...} Perfect! :-P
Nov 30 2007
parent reply Matti Niemenmaa <see_signature for.real.address> writes:
Bill Baxter wrote:
 Now you're on to something!  Just tweak that last one slightly:
 
   (this is !in function) int my_method() {...}
 
 Perfect!

Nah, this one's perfect: (this function is !in this class) int my_method() {...} -- E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi
Nov 30 2007
next sibling parent Robert Fraser <fraserofthenight gmail.com> writes:
Matti Niemenmaa wrote:
 Bill Baxter wrote:
 Now you're on to something!  Just tweak that last one slightly:

   (this is !in function) int my_method() {...}

 Perfect!

Nah, this one's perfect: (this function is !in this class) int my_method() {...}

(this function is !in this instanceof this class) int my_method() {...}
Nov 30 2007
prev sibling next sibling parent reply BCS <BCS pathlink.com> writes:
Matti Niemenmaa wrote:
 Bill Baxter wrote:
 
Now you're on to something!  Just tweak that last one slightly:

  (this is !in function) int my_method() {...}

Perfect!

Nah, this one's perfect: (this function is !in this class) int my_method() {...}

Free kudos* to the first person to get a haiku of key words to compile. Anyone want to go for a limerick? * kudos will consist of "well done ____" being posted where ____ is replaced with the name of the person awarded said kudos.
Nov 30 2007
next sibling parent Christopher Wright <dhasenan gmail.com> writes:
BCS wrote:
 Matti Niemenmaa wrote:
 Bill Baxter wrote:

 Now you're on to something!  Just tweak that last one slightly:

  (this is !in function) int my_method() {...}

 Perfect!

Nah, this one's perfect: (this function is !in this class) int my_method() {...}

Free kudos* to the first person to get a haiku of key words to compile. Anyone want to go for a limerick? * kudos will consist of "well done ____" being posted where ____ is replaced with the name of the person awarded said kudos.

Problem is, most keywords don't work too close to each other. If you allow arbitrary identifiers, too easy.
Nov 30 2007
prev sibling parent reply Matti Niemenmaa <see_signature for.real.address> writes:
BCS wrote:
 Free kudos* to the first person to get a haiku of key words to compile.

protected static this() { if (new short) assert (is( typeof(typeid(int)))); }
 Anyone want to go for a limerick?

static assert (is(typeof(new short))); static this() { if (new short is new short) volatile if (true) try { debug null; do {} while (false); } catch { return new ushort;}} Both compile with 1.024. With 2.0 one could probably use the const stuff to good effect. -- E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi
Dec 01 2007
next sibling parent BCS <ao pathlink.com> writes:
Reply to Matti,

 BCS wrote:
 
 Free kudos* to the first person to get a haiku of key words to
 compile.
 

this() { if (new short) assert (is( typeof(typeid(int)))); }
 Anyone want to go for a limerick?
 

static this() { if (new short is new short) volatile if (true) try { debug null; do {} while (false); } catch { return new ushort;}} Both compile with 1.024. With 2.0 one could probably use the const stuff to good effect.

well done Matti!!! That is cool.
Dec 02 2007
prev sibling parent Sebastian Beschke <s.beschke gmx.de> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Matti Niemenmaa schrieb:
 BCS wrote:
 Free kudos* to the first person to get a haiku of key words to compile.

protected static this() { if (new short) assert (is( typeof(typeid(int)))); }
 Anyone want to go for a limerick?

static assert (is(typeof(new short))); static this() { if (new short is new short) volatile if (true) try { debug null; do {} while (false); } catch { return new ushort;}} Both compile with 1.024. With 2.0 one could probably use the const stuff to good effect.

OMG. Well done Matti. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHU1VuKb/1n5A2TAMRAh/TAJ0bo2rJlbIQaaF8gE2hy225PonKYgCfSqpG VKD0g+HUK/VByPhzfL/n1i8= =z6N3 -----END PGP SIGNATURE-----
Dec 02 2007
prev sibling parent Leandro Lucarella <llucax gmail.com> writes:
Matti Niemenmaa, el 30 de noviembre a las 21:11 me escribiste:
 Bill Baxter wrote:
 Now you're on to something!  Just tweak that last one slightly:
 
   (this is !in function) int my_method() {...}
 
 Perfect!

Nah, this one's perfect: (this function is !in this class) int my_method() {...}

The obvious missing one is:
 (class function with out this) int my_method() {...}

-- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- Oiganmen ñatos de corazón, es más posible que un potus florezca en primavera a que un ángel pase con una remera. -- Peperino Pómoro
Nov 30 2007
prev sibling parent Robert Fraser <fraserofthenight gmail.com> writes:
Matti Niemenmaa wrote:
 (this is !in this) int my_method() {...}

You get an oatmeal rasin cookie for that! And an easter egg in the Descent parser that won't mark that as a syntax error if I'm feeling bored.
Nov 30 2007