www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DMD 0.91 release

reply "Walter" <newshound digitalmars.com> writes:
Mainly more bug fixes.

http://www.digitalmars.com/d/changelog.html
May 28 2004
next sibling parent reply Ant <duitoolkit yahoo.ca> writes:
On Fri, 28 May 2004 16:52:45 -0700, Walter wrote:

 Mainly more bug fixes.
 
 http://www.digitalmars.com/d/changelog.html
from the change log:
 typeof(this).member() now does non-virtual call to member().
bad idea, bad sintax. Ant
May 28 2004
next sibling parent MarkT <MarkT_member pathlink.com> writes:
In article <pan.2004.05.29.02.07.33.528199 yahoo.ca>, Ant says...
On Fri, 28 May 2004 16:52:45 -0700, Walter wrote:

 Mainly more bug fixes.
 
 http://www.digitalmars.com/d/changelog.html
from the change log:
 typeof(this).member() now does non-virtual call to member().
bad idea, bad sintax.
agreed (bad syntax) - don't overload every word until it becomes meaningless What is with void returning expressions? void is for procedures create an "any" type or something similar
May 29 2004
prev sibling parent Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
Ant wrote:
 On Fri, 28 May 2004 16:52:45 -0700, Walter wrote:
 
 
Mainly more bug fixes.

http://www.digitalmars.com/d/changelog.html
from the change log:
typeof(this).member() now does non-virtual call to member().
bad idea, bad sintax. Ant
What about this syntax? this.(ClassName.member)() I know that it doesn't look right, but it does express exactly what you intend: call this specific implementation using the 'this' pointer.
Jun 04 2004
prev sibling next sibling parent reply J Anderson <REMOVEanderson badmama.com.au> writes:
Walter wrote:

Mainly more bug fixes.

http://www.digitalmars.com/d/changelog.html
  
Wow, you implemented my typeof(this) idea, thanks. -- -Anderson: http://badmama.com.au/~anderson/
May 28 2004
next sibling parent "Walter" <newshound digitalmars.com> writes:
"J Anderson" <REMOVEanderson badmama.com.au> wrote in message
news:c98uut$g4r$1 digitaldaemon.com...
 Walter wrote:

Mainly more bug fixes.

http://www.digitalmars.com/d/changelog.html
Wow, you implemented my typeof(this) idea, thanks.
It was inevitable, because this had to work, too: class A { void foo() { } void bar() { A.foo(); } }
May 28 2004
prev sibling parent reply hellcatv hotmail.com writes:
isn't typeof(this) a pointer?
shouldn't it be typeof(*this) ? 
or am I silly or in C++ land

does this mean if I do

(MyClass*).happy()
it will call the MyClass happy func?

In article <c98uut$g4r$1 digitaldaemon.com>, J Anderson says...
Walter wrote:

Mainly more bug fixes.

http://www.digitalmars.com/d/changelog.html
  
Wow, you implemented my typeof(this) idea, thanks. -- -Anderson: http://badmama.com.au/~anderson/
May 28 2004
parent J Anderson <REMOVEanderson badmama.com.au> writes:
hellcatv hotmail.com wrote:

isn't typeof(this) a pointer?
shouldn't it be typeof(*this) ? 
or am I silly or in C++ land
  
Your living in C++ land. Remember in C++ you had to use -> if it was a pointer to access a member. Also remember that all classes in D are pointers.
does this mean if I do

(MyClass*).happy()
it will call the MyClass happy func?
  
I think you mean: (*MyClass).happy(); which will not work as D hides the fact that classes are pointers (actually they are more like references in some respects). -- -Anderson: http://badmama.com.au/~anderson/
May 28 2004
prev sibling parent reply "Ivan Senji" <ivan.senji public.srce.hr> writes:
Great: "Allow functions that return void to return expressions. "
I was for this too BUT:

import std.c.stdio;

class A{}

void F1(int x)
{
 printf("F1(%d)\n",x);
 return new A();
}

void F2(int x)
{
 printf("F2(%d)\n",x);
 return F1(x);
}

int main ( char [] [] args )
{
 F2(100);
}

This code compiles ok. It seams that a function returning void can
now return anything, is it the expected behaviour?
I would expect the return in F1 not to work and the one in F2 to work?


"Walter" <newshound digitalmars.com> wrote in message
news:c98ju4$17o$1 digitaldaemon.com...
 Mainly more bug fixes.

 http://www.digitalmars.com/d/changelog.html
May 29 2004
parent reply "Walter" <newshound digitalmars.com> writes:
Yes, any type can be implicitly converted to void. -Walter

"Ivan Senji" <ivan.senji public.srce.hr> wrote in message
news:c99hap$1f97$1 digitaldaemon.com...
 Great: "Allow functions that return void to return expressions. "
 I was for this too BUT:

 import std.c.stdio;

 class A{}

 void F1(int x)
 {
  printf("F1(%d)\n",x);
  return new A();
 }

 void F2(int x)
 {
  printf("F2(%d)\n",x);
  return F1(x);
 }

 int main ( char [] [] args )
 {
  F2(100);
 }

 This code compiles ok. It seams that a function returning void can
 now return anything, is it the expected behaviour?
 I would expect the return in F1 not to work and the one in F2 to work?


 "Walter" <newshound digitalmars.com> wrote in message
 news:c98ju4$17o$1 digitaldaemon.com...
 Mainly more bug fixes.

 http://www.digitalmars.com/d/changelog.html
May 29 2004
next sibling parent reply Sean Kelly <sean f4.ca> writes:
Walter wrote:

 Yes, any type can be implicitly converted to void. -Walter
And any type can also be implicitly converted to Object as well, correct? Why the addition of implicit void conversions? Sean
May 29 2004
parent reply "Walter" <newshound digitalmars.com> writes:
"Sean Kelly" <sean f4.ca> wrote in message
news:c9ammk$1ri$1 digitaldaemon.com...
 Walter wrote:

 Yes, any type can be implicitly converted to void. -Walter
And any type can also be implicitly converted to Object as well, correct?
No, only objects derived from Object.
  Why the addition of implicit void conversions?
To make it easy to return an expression from a void function.
 Sean
May 29 2004
parent reply Antti =?iso-8859-1?Q?Syk=E4ri?= <jsykari gamma.hut.fi> writes:
In article <c9aq9h$79m$1 digitaldaemon.com>, Walter wrote:
  Why the addition of implicit void conversions?
To make it easy to return an expression from a void function.
Why would you want to? Unless its type is void, of course, but then you don't need an implicit void conversion in the first place. -Antti -- I will not be using Plan 9 in the creation of weapons of mass destruction to be used by nations other than the US.
May 30 2004
parent reply "Walter" <newshound digitalmars.com> writes:
"Antti Sykäri" <jsykari gamma.hut.fi> wrote in message
news:slrncbl07d.o2l.jsykari pulu.hut.fi...
 In article <c9aq9h$79m$1 digitaldaemon.com>, Walter wrote:
  Why the addition of implicit void conversions?
To make it easy to return an expression from a void function.
Why would you want to? Unless its type is void, of course, but then you don't need an implicit void conversion in the first place.
I'm not sure if it was a good idea or not :-(
May 31 2004
parent Arcane Jill <Arcane_member pathlink.com> writes:
In article <c9elv9$2e5f$1 digitaldaemon.com>, Walter says...
"Antti Sykäri" <jsykari gamma.hut.fi> wrote in message
news:slrncbl07d.o2l.jsykari pulu.hut.fi...
 In article <c9aq9h$79m$1 digitaldaemon.com>, Walter wrote:
  Why the addition of implicit void conversions?
To make it easy to return an expression from a void function.
Why would you want to? Unless its type is void, of course, but then you don't need an implicit void conversion in the first place.
I'm not sure if it was a good idea or not :-(
This is what's needed. You need to imagine the concept of an expression with type void. There should be *only* two ways to create such an expression; (1) return; // returns an expression of type void; (2) return expr; // see below The second possibility returns an expression of type void IF AND ONLY IF expr is itself an expression of type void, otherwise it's a compile error. It's that simple. PS. C allows the following. I don't think we should copy it.
       int f(int x)
       {
           (void) x;
           /* stuff */
       }
The intent here is to disable compiler warnings about x not being used.
May 31 2004
prev sibling parent reply "Ivan Senji" <ivan.senji public.srce.hr> writes:
"Walter" <newshound digitalmars.com> wrote in message
news:c9aj4e$2ukl$1 digitaldaemon.com...
 Yes, any type can be implicitly converted to void. -Walter
Thanks! By the way: is there any way to convert it void to another type?
 "Ivan Senji" <ivan.senji public.srce.hr> wrote in message
 news:c99hap$1f97$1 digitaldaemon.com...
 Great: "Allow functions that return void to return expressions. "
 I was for this too BUT:

 import std.c.stdio;

 class A{}

 void F1(int x)
 {
  printf("F1(%d)\n",x);
  return new A();
 }

 void F2(int x)
 {
  printf("F2(%d)\n",x);
  return F1(x);
 }

 int main ( char [] [] args )
 {
  F2(100);
 }

 This code compiles ok. It seams that a function returning void can
 now return anything, is it the expected behaviour?
 I would expect the return in F1 not to work and the one in F2 to work?


 "Walter" <newshound digitalmars.com> wrote in message
 news:c98ju4$17o$1 digitaldaemon.com...
 Mainly more bug fixes.

 http://www.digitalmars.com/d/changelog.html
May 29 2004
parent "Walter" <newshound digitalmars.com> writes:
"Ivan Senji" <ivan.senji public.srce.hr> wrote in message
news:c9atft$bld$1 digitaldaemon.com...
 "Walter" <newshound digitalmars.com> wrote in message
 news:c9aj4e$2ukl$1 digitaldaemon.com...
 Yes, any type can be implicitly converted to void. -Walter
Thanks! By the way: is there any way to convert it void to another type?
No.
May 29 2004