Re: Implicit overloads, non static



Jon Skeet [C# MVP] <skeet@xxxxxxxxx> wrote in
news:MPG.1ce5f6ef1d5d5b1698c0ac@xxxxxxxxxxxxxxxxxxxx:
> Well, you've disputed whether it's a matter of implementation rather
> than principle. The fact that you'd *like* to do something which to me

I didnt necessarily want to do it - the code I posted was just to show
"What" it would do. Im using the copy constructor behaviour and am just
fine with that.

> I guess we can only talk about our own experiences, however different
> they may be. The discrepancy does seem very odd though - I wonder what
> the cause is.

It's easy - 1 to 5, 0, to 4, goofing up of the condition mostly.

> Sure, that's clearer - but I wasn't disputing that. You said you prefer
> your developers to use while loops, and I was saying that I find them
> harder to read than for loops. Maybe we're talking at cross-purposes
> though.

Aah - sorry I should have clarified that. I prefer they use while loops
*when* its not a simple for i = 1 to 5 condition. Certainly not for that
condition. :)

> Only if you'd really find life hard without them. I don't find life
> hard in Java where I don't have them, therefore they're not that
> important to me.

I find a lot of things hard in Java. Ack what they call properties... They
are methods! There's no property about it - its a blooddy pattern I could
do in VB... reminds me of OOP in SAS.

> And for almost every use, I'd go along with that. Other than the types
> defined in the language spec, I think it's pretty much always a bad
> idea to have implicit conversion. Being able to provide *explicit*
> conversion operators is not quite so bad, although it should still be
> used with a lot of care.

Here is where we will strongly disagree then for sure.

> No, I think we're disagreeing more fundamentally. Your examples have
> shown that you think it's not always a bad idea to violate the
> principle that if I do:
>
><variable> = <expression>;
>
> I should be able to look at <expression> and completely know the value
> of the variable. That's not a matter of what's important or not, it's a
> case of what violates entirely reasonable assumptions that pretty much
> every developer makes subconciously all the time.

But you *do* know the value. Becuase its a new value type.

BCD x = 4;

decimal i = x;

i equals 4.

It *is* a new value type - and thus its value is 4. There are many other
non value type uses for implicits too.

> Right. I'm not sure I'd call that a copy constructor myself, but that's
> not terribly important. (I usually wouldn't use the phrase "copy
> constructor" outside C++, and then only when the parameter to the
> constructor was of the same type as the object being constructed.)

Yes - true. Its not a copy constructor, its similar behavioru. I introduced
the term when I was describing some behaviour, and its gone out of context
since then.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Develop ASP.NET applications easier and in less time:
http://www.atozed.com/IntraWeb/
.



Relevant Pages

  • Re: Implicit overloads, non static
    ... you've disputed whether it's a matter of implementation rather ... that's clearer - but I wasn't disputing that. ... > I find a lot of things hard in Java. ... I'm not sure I'd call that a copy constructor myself, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Can I know if "new Func()" or "Func()" is called?
    ... of a real javascript programming experience that I could ... your assertion that "If there is statement in the constructor ... statement" was false is so self-evidently not true my mere suggesting it ... any mean - rather than thinking on the matter itself. ...
    (comp.lang.javascript)
  • Re: Window class - ?
    ... > else return DefWindowProc(hWnd, uMsg, wParam, lParam); ... >But why should this matter? ... CreateWindow, and happens before the call to CreateWindow returns to you. ... That call is happening inside your object's constructor. ...
    (microsoft.public.vc.language)
  • Re: Constructor return value?
    ... we can only construct members that themselves obey the RAII ... > This situation should be handled by following the RAII principle: ... This is most important if the constructor allocates resources ... >> struct C ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Constructor return value?
    ... we can only construct members that themselves obey the RAII ... > This situation should be handled by following the RAII principle: ... This is most important if the constructor allocates resources ... >> struct C ...
    (microsoft.public.vc.language)