digitalmars.D - Idea for getting rid of "static" on methods
- Bill Baxter (6/6) Nov 30 2007 Nobody likes how overused static is, so here's an idea for a syntax to
- Craig Black (3/9) Nov 30 2007 What are you joking about? Did someone suggest getting rid of static?
- Janice Caron (5/6) Nov 30 2007 I'm sure he's joking. He's figured out that "with", "out" and "this"
- Bill Baxter (11/25) Nov 30 2007 Not recently, but it always comes up top on the list of confusingly
- Matti Niemenmaa (13/16) Nov 30 2007 How about:
- Bill Baxter (5/23) Nov 30 2007 Now you're on to something! Just tweak that last one slightly:
- Matti Niemenmaa (5/10) Nov 30 2007 Nah, this one's perfect:
- Robert Fraser (3/14) Nov 30 2007 If only we had Java's instanceof:
- BCS (5/18) Nov 30 2007 Free kudos* to the first person to get a haiku of key words to compile.
- Christopher Wright (3/24) Nov 30 2007 Problem is, most keywords don't work too close to each other. If you
- Matti Niemenmaa (13/15) Dec 01 2007 protected static
- BCS (3/21) Dec 02 2007 well done Matti!!!
- Sebastian Beschke (12/30) Dec 02 2007 -----BEGIN PGP SIGNED MESSAGE-----
- Leandro Lucarella (10/21) Nov 30 2007 --
- Robert Fraser (3/4) Nov 30 2007 You get an oatmeal rasin cookie for that! And an easter egg in the
- Mike (4/30) Dec 02 2007 This reminds me of this:
- Matti Niemenmaa (43/48) Dec 03 2007 class X {
- Christopher Wright (3/62) Dec 03 2007 You could've done 'alias __traits(something...) identifier' instead, for...
- Matti Niemenmaa (5/7) Dec 03 2007 TBH I didn't use __traits because I don't have a 2.0 compiler handy. I d...
- Christopher Wright (5/78) Dec 03 2007 My mistake; that wouldn't actually increase it, if you're only counting
-
Matti Niemenmaa
(10/27)
Dec 03 2007
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
"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! --bbWhat are you joking about? Did someone suggest getting rid of static?
Nov 30 2007
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
Craig Black wrote:"Bill Baxter" <dnewsgroup billbaxter.com> wrote in message news:fipjds$cft$1 digitalmars.com...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. --bbNobody 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! --bbWhat are you joking about? Did someone suggest getting rid of static?
Nov 30 2007
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
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! :-PSomething 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.
Nov 30 2007
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
Matti Niemenmaa wrote:Bill Baxter wrote:If only we had Java's instanceof: (this function is !in this instanceof this class) int my_method() {...}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() {...}
Nov 30 2007
Matti Niemenmaa wrote:Bill Baxter wrote: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.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() {...}
Nov 30 2007
BCS wrote:Matti Niemenmaa wrote:Problem is, most keywords don't work too close to each other. If you allow arbitrary identifiers, too easy.Bill Baxter wrote: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.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() {...}
Nov 30 2007
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
Reply to Matti,BCS wrote:well done Matti!!! That is cool.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.
Dec 02 2007
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Matti Niemenmaa schrieb:BCS wrote: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-----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.
Dec 02 2007
Matti Niemenmaa, el 30 de noviembre a las 21:11 me escribiste:Bill Baxter wrote:The obvious missing one is: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() {...}(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
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
This reminds me of this: http://forums.worsethanfailure.com/forums/thread/82701.aspx Maybe we could try the same with D :) BCS Wrote:Reply to Matti,BCS wrote:well done Matti!!! That is cool.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.
Dec 02 2007
Mike wrote:This reminds me of this: http://forums.worsethanfailure.com/forums/thread/82701.aspx Maybe we could try the same with D :)class X { void f() /+ begin +/ in {} out {} body {} align abstract auto const debug deprecated export extern final package private protected public scope synchronized struct { static union {} } override invariant { asm{} try volatile with (typeof(super)) switch(typeid(char) is null) { goto default; case false: } catch { throw new class {}; } finally {} delete this; } unittest { for (;;) if (cast(bool)true) { do continue; while (function(){}); } else break; return assert(delegate void(lazy byte, ref cdouble, inout cfloat, creal, dchar, double, float, idouble, ifloat, ireal, long, real, ubyte, uint, ulong, ushort, wchar){}); } } alias int /+ end +/ x; 83 keywords of a possible 98 (unless I missed some). The code compiles with -unittest -debug. There's one warning "switch statement has no default" if compiled with -w, though, so I guess I only get 82 points according to the rules there. :-) The class is needed only to get the anonymous struct, otherwise it could be all at global scope. Keywords which can't be used at all: cent, ucent, macro The rest of the keywords need an identifier and thus can't be used without breaking the chain. Feel free to prove me wrong, of course. :-) I chose to use "alias" at the end there because it happened to be alphabetically the first. The other options: enum, import, interface, foreach, foreach_reverse, mixin, module pragma, template, typedef, version, __traits -- E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi
Dec 03 2007
Matti Niemenmaa wrote:Mike wrote:You could've done 'alias __traits(something...) identifier' instead, for one extra.This reminds me of this: http://forums.worsethanfailure.com/forums/thread/82701.aspx Maybe we could try the same with D :)class X { void f() /+ begin +/ in {} out {} body {} align abstract auto const debug deprecated export extern final package private protected public scope synchronized struct { static union {} } override invariant { asm{} try volatile with (typeof(super)) switch(typeid(char) is null) { goto default; case false: } catch { throw new class {}; } finally {} delete this; } unittest { for (;;) if (cast(bool)true) { do continue; while (function(){}); } else break; return assert(delegate void(lazy byte, ref cdouble, inout cfloat, creal, dchar, double, float, idouble, ifloat, ireal, long, real, ubyte, uint, ulong, ushort, wchar){}); } } alias int /+ end +/ x; 83 keywords of a possible 98 (unless I missed some). The code compiles with -unittest -debug. There's one warning "switch statement has no default" if compiled with -w, though, so I guess I only get 82 points according to the rules there. :-) The class is needed only to get the anonymous struct, otherwise it could be all at global scope. Keywords which can't be used at all: cent, ucent, macro The rest of the keywords need an identifier and thus can't be used without breaking the chain. Feel free to prove me wrong, of course. :-) I chose to use "alias" at the end there because it happened to be alphabetically the first. The other options: enum, import, interface, foreach, foreach_reverse, mixin, module pragma, template, typedef, version, __traits
Dec 03 2007
Christopher Wright wrote:You could've done 'alias __traits(something...) identifier' instead, for one extra.TBH I didn't use __traits because I don't have a 2.0 compiler handy. I didn't know I could do that, cheers. :-) -- E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi
Dec 03 2007
Christopher Wright wrote:Matti Niemenmaa wrote:My mistake; that wouldn't actually increase it, if you're only counting globally reserved keywords. If you could have an anonymous template, you could do: mixin (template () { module foo; })!();Mike wrote:You could've done 'alias __traits(something...) identifier' instead, for one extra.This reminds me of this: http://forums.worsethanfailure.com/forums/thread/82701.aspx Maybe we could try the same with D :)class X { void f() /+ begin +/ in {} out {} body {} align abstract auto const debug deprecated export extern final package private protected public scope synchronized struct { static union {} } override invariant { asm{} try volatile with (typeof(super)) switch(typeid(char) is null) { goto default; case false: } catch { throw new class {}; } finally {} delete this; } unittest { for (;;) if (cast(bool)true) { do continue; while (function(){}); } else break; return assert(delegate void(lazy byte, ref cdouble, inout cfloat, creal, dchar, double, float, idouble, ifloat, ireal, long, real, ubyte, uint, ulong, ushort, wchar){}); } } alias int /+ end +/ x; 83 keywords of a possible 98 (unless I missed some). The code compiles with -unittest -debug. There's one warning "switch statement has no default" if compiled with -w, though, so I guess I only get 82 points according to the rules there. :-) The class is needed only to get the anonymous struct, otherwise it could be all at global scope. Keywords which can't be used at all: cent, ucent, macro The rest of the keywords need an identifier and thus can't be used without breaking the chain. Feel free to prove me wrong, of course. :-) I chose to use "alias" at the end there because it happened to be alphabetically the first. The other options: enum, import, interface, foreach, foreach_reverse, mixin, module pragma, template, typedef, version, __traits
Dec 03 2007
Christopher Wright wrote:Christopher Wright wrote:<snip>Matti Niemenmaa wrote:<snip>return assert(delegate void(lazy byte, ref cdouble, inout cfloat, creal, dchar, double, float, idouble, ifloat, ireal, long, real, ubyte, uint, ulong, ushort, wchar){}); } } alias int /+ end +/ x;Sure it would. "int" can be moved into that delegate and then we'd have __traits in addition to everything I originally used.You could've done 'alias __traits(something...) identifier' instead, for one extra.My mistake; that wouldn't actually increase it, if you're only counting globally reserved keywords.If you could have an anonymous template, you could do: mixin (template () { module foo; })!();Yeah, anonymous templates would chop off a few keywords off the "left-over" list. I'm not sure if putting module in a template like that would work, though, but there are plenty of other options if it doesn't. -- E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi
Dec 03 2007