|
![](/i/fill.gif) |
On 8/16/2012 1:38, Invisible wrote:
> It still works if you take Show out. (Although in that case it becomes even
> more pointless.)
As it does in C#. You return Object.
> My point isn't that this is a useful thing to do. It's just that it doesn't
> necessarily /have/ to be impossible. C# /chose/ to make it impossible - a
> not unreasonable choice, but not the /only/ choice.
You're just arguing syntax at this point. If I return a value and there's
nothing you can do with that value that you can't do with every other value
of every other type, then you've returned Object. You haven't returned a
value of a private type - you've cast it to a value that has no operations
defined except assignment.
> According to the spec document, any value of a value type is not formally
> referred to as an "object"; that term is reserved for values of reference
> type. Similarly, the term "class" is reserved to refer to types declared
> with the "class" keyword.
Not you're picking nits.
> Of course, with the C# unified type system, all types /behave/ as classes in
> the usual OO sense (which is the point you're making). It's just that the C#
> language spec does not /call/ then classes.
Are they all subclasses of Object? How can you have a subclass of Object
that isn't in turn an object? :-)
>> They correspond to integers. They aren't integers. I *do* think Java did
>> that one much better.
>
> What, by not having enumerations at all?
No. Java has actual useful enums, which are basically classes with a finite
collection of named static instances created at compile-time.
>>> If you have real enumerations, why do you need a special-case for bool?
>>
>> Because you have syntax in the language that uses specific types, like
>> "if" statements.
>
> Haskell has special if syntax, and yet Bool is defined in library code.
So? bool is defined in library code too. System.Boolean in mscorlib.dll
>> Hermes, for example, does not have a string type. But if you have an
>> enum where each name is one character long, you can make an array of
>> that value by sticking it inside quotes. Which I thought was kind of cute.
>
> Nice. :-S
And then there's ACT.1, where a number like 534 is actually a big long
expression that is ((5 * 10 + 3) * 10) + 4. I.e., similarly to the way
Hermes does strings, ACT.1 does every literal including integers and floats.
"Int" is actually a source code library.
--
Darren New, San Diego CA, USA (PST)
"Oh no! We're out of code juice!"
"Don't panic. There's beans and filters
in the cabinet."
Post a reply to this message
|
![](/i/fill.gif) |