Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / February 2005

Tip: Looking for answers? Try searching our database.

Primitive Type Definition

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ice - 25 Jan 2005 06:07 GMT
All -

Up till now (at least in my opinion) the definition of a primitive type has
been at a language level.  You can refer to this definition on msdn at
ms-help://MS.NETFrameworkSDKv1.1/vblsnet/html/vblrfVBSpec6_2.htm

However, in reading Jeffrey Richters book (Applied Microsoft .NET Framework
Programming), he mentions the term "CLR primitive values" and illustrates
that at the "CLR level", Decimal is not a primitive type.

I guess my question is:  At what level do we make the decision as to whether
a type is a "primitive type"?  At both the language and CLR level?  Is there
another name/term/defintion for "types" that have specific IL instructions
that manipulate their values?

I'm interested to know what people's opinions are.

Thanks.

ice
Jon Skeet [C# MVP] - 25 Jan 2005 07:07 GMT
> Up till now (at least in my opinion) the definition of a primitive type has
> been at a language level.  You can refer to this definition on msdn at
[quoted text clipped - 10 lines]
>
> I'm interested to know what people's opinions are.

C# defines simple types but not primitive types. (It mentions
"primitive" types, but always in quotes as a sort of "you know what I
mean here" rather than defining them.) I think the CLR level is really
the one it makes sense to define primitive types at.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Ice - 25 Jan 2005 08:19 GMT
> > Up till now (at least in my opinion) the definition of a primitive type has
> > been at a language level.  You can refer to this definition on msdn at
[quoted text clipped - 15 lines]
> mean here" rather than defining them.) I think the CLR level is really
> the one it makes sense to define primitive types at.

Yeah, just saw that in the C# language specification although the VB
specification uses "primitive" type.  You would think that it would be
consistent.  Books also use "primitive" type.
Mujtaba Syed - 25 Jan 2005 19:38 GMT
CLR types can be bifurcated as value types and reference types. Primitive
types are some commonly used types like Int32, Single, String, and Boolean
are primitive types. These types generally have aliases defined in
languages. All primitive types except string are value types.

Mujtaba.

> > > Up till now (at least in my opinion) the definition of a primitive type
> has
[quoted text clipped - 25 lines]
> specification uses "primitive" type.  You would think that it would be
> consistent.  Books also use "primitive" type.
Jon Skeet [C# MVP] - 25 Jan 2005 20:14 GMT
> CLR types can be bifurcated as value types and reference types. Primitive
> types are some commonly used types like Int32, Single, String, and Boolean
> are primitive types. These types generally have aliases defined in
> languages. All primitive types except string are value types.

Actually, String isn't a primitive type. From MSDN:

<quote>
The primitive types are Boolean, Byte, SByte, Int16, UInt16, Int32,
UInt32, Int64, UInt64, Char, Double, and Single.
</quote>

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Ice - 26 Jan 2005 15:52 GMT
so do you consider "decimal" to be a primitive?
> CLR types can be bifurcated as value types and reference types. Primitive
> types are some commonly used types like Int32, Single, String, and Boolean
[quoted text clipped - 33 lines]
> > specification uses "primitive" type.  You would think that it would be
> > consistent.  Books also use "primitive" type.
Jon Skeet [C# MVP] - 26 Jan 2005 17:20 GMT
> so do you consider "decimal" to be a primitive?

No - nor is DateTime, which is probably the next most commonly used
value type after the primitives.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Ice - 27 Jan 2005 05:00 GMT
so the documentation is wrong or misleading.
eb
> > so do you consider "decimal" to be a primitive?
>
> No - nor is DateTime, which is probably the next most commonly used
> value type after the primitives.
Jon Skeet [C# MVP] - 27 Jan 2005 07:24 GMT
> so the documentation is wrong or misleading.

Well, it just means that the VB.NET idea of a primitive type isn't the
same as the CLR's idea of a primitive type.

That's somewhat confusing, but may well be historical.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Abubakar - 14 Feb 2005 06:50 GMT
> so do you consider "decimal" to be a primitive?

u can check it with following code:

Dim t As Type = GetType(Decimal)
Console.WriteLine("primtive {0}.", t.IsPrimitive)

It'll return false for decimal.

Ab.
Abubakar - 14 Feb 2005 06:48 GMT
Dim t As Type = GetType(String)
Console.WriteLine("primtive {0}.", t.IsPrimitive)

will display False.

Ab.

> CLR types can be bifurcated as value types and reference types. Primitive
> types are some commonly used types like Int32, Single, String, and Boolean
[quoted text clipped - 38 lines]
> > specification uses "primitive" type.  You would think that it would be
> > consistent.  Books also use "primitive" type.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.