[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ProgSoc] Programming! Code!



On Fri, 2006-10-20 at 03:02 +1000, John Elliot wrote:

> On Thursday 19 October 2006 19:54, Roland Turner wrote:
> > Has the Tortoise started breaking Achilles' record players yet?
> 
> No. (...and, yes.)
> 
> The Tortoise doesn't break Achilles's (sic) record players. The Tortoise 
> breaks the Crab's record players...

:-)

OK, I'd forgotten that.

I suspect from your on-list discussion with yourself yesterday that
you've now seen my point? Each constraint you add merely invites the
Tortoise to add another element to his rebuttal.

(This point is actually even more clearly made in Alice Carroll's
original dialogue, which I believe appears as the "two part invention"
after GEB chapter two.)

> ValueType inherits from Object, but it is fundamentally different. A 
> value type is not an 'object' (i.e. allocated an object id and managed 
> by the GC) unless it is boxed.

That would be too obvious. At least Meyer had the good taste to have
OBJECT extend ANY, and to have the value types also extend ANY, not
OBJECT.

> ValueTypes implement copy-by-value semantics.
> 
> To declare a value type (derives from ValueType) in C# you declare 
> a 'struct'. To declare a reference type (does not derive from 
> ValueType) you declare a 'class'.

OK, so ValueTypes actually behave somewhat like structs (the ANSI ones,
not the K&R ones) in C.

> Boxing occurs when a value type is stored in a reference type variable.

OK.

> E.g. boxing occurs here:
> 
>  Object o = true; // <-- boxed

(boggle)

Does Object have some sort of generic ValueType field that can hold an
instance of any ValueType?

> Unboxing occurs here:
> 
>  Object o = true;        // <-- boxed
>  Boolean b = (Boolean)o; // <-- unboxed

Still boggling at what's going on under the covers here.

> Spec# refers to non-null reference types (the Null Object pattern is 
> better, null references are stupid).

Umm, what's the difference? What is a Null Object?

> It is possible to represent 'null values' in a value type and to 
> implement for those types TVL (three-valued logic). 

OK.

- Raz


-
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@xxxxxxxxxxxxxxxxxxx
If you are having trouble, ask owner-progsoc@xxxxxxxxxxxxxxxxxx for help.