473,386 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

System.Diagnostics.Debug.Assert();

System.Diagnostics.Debug.Assert();

Hello??? A language should encourage programmers to heavily use the
assert-feature, since it improves safety, stability, readability and
maintainability of software. Most language designers recognized this, see
C/C++ and Java which supports an assert keyword.

My question now is, will C# support in future a single keyword for
System.Diagnostics.Debug.Assert(), just like lock is a keyword for
Monitor.Enter()?

Putting "using System.Diagnostics.Debug;" in every single source file, is
not acceptable for me.
assert is/should be used in every application, no matter which kind of
application it is. Name me just one method/class where this is also the
case.

What do you think?

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 16 '05 #1
2 5840
cody wrote:
System.Diagnostics.Debug.Assert();

Hello??? A language should encourage programmers to heavily use the
assert-feature, since it improves safety, stability, readability and
maintainability of software. Most language designers recognized this, see
C/C++ and Java which supports an assert keyword.

My question now is, will C# support in future a single keyword for
System.Diagnostics.Debug.Assert(), just like lock is a keyword for
Monitor.Enter()?

Putting "using System.Diagnostics.Debug;" in every single source file, is
not acceptable for me.
assert is/should be used in every application, no matter which kind of
application it is. Name me just one method/class where this is also the
case.

What do you think?


I agree that this probably would have been a good thing to have in
version 1.0, but I doubt they'd add it as a keyword now.

It would break some existing code, and the current usage of
Debug.Assert() (in conjunction with a "using System.Diagnostics;")
already does the job pretty much as well an "assert" keyword would so
there's little added benefit.

Note that the lock statement is more than just Monitor.Enter()... It
encapsulates Monitor.Enter() followed by a try/finally block that
ensures that Monitor.Exit() is called.

--
mikeb
Nov 16 '05 #2
> > System.Diagnostics.Debug.Assert();

Hello??? A language should encourage programmers to heavily use the
assert-feature, since it improves safety, stability, readability and
maintainability of software. Most language designers recognized this, see C/C++ and Java which supports an assert keyword.

My question now is, will C# support in future a single keyword for
System.Diagnostics.Debug.Assert(), just like lock is a keyword for
Monitor.Enter()?

Putting "using System.Diagnostics.Debug;" in every single source file, is not acceptable for me.
assert is/should be used in every application, no matter which kind of
application it is. Name me just one method/class where this is also the
case.

What do you think?

I agree that this probably would have been a good thing to have in
version 1.0, but I doubt they'd add it as a keyword now.

It would break some existing code,


It is so stupid. Didn't they think of the possibility that more keywords may
be added in later versions of C#???
If I would design a language I would reserve as much keywords in advance in
the first place so I have later no problems with adding new keywords.
I'd reserved things like
(yield,where,assert,mutable,friend,delete,with,fin al,native) in advance so
that later no problems arise with compatibility. It seems that almost all
programming languages I know of suffer from that problem, exception
javascript: It has a huge list of reserved words that aren't actually used.
and the current usage of
Debug.Assert() (in conjunction with a "using System.Diagnostics;")
already does the job pretty much as well an "assert" keyword would so
there's little added benefit.

Note that the lock statement is more than just Monitor.Enter()... It
encapsulates Monitor.Enter() followed by a try/finally block that
ensures that Monitor.Exit() is called.


int is just System.Int32 but they made it a keyword. assert *should* just li
ke int used all over the whole program to ensure consistence of the
software.
also, the assert should be quickly be recognized as an assert so a keyword
is probably the right thing.

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andreas Müller | last post by:
Hi, I just wanted to know if I risk any overhead using Debug.Assert. Will the compiler remove the complete statement on a releasey build? Thanks in advance, Andy
3
by: Travis | last post by:
I am trying to display a query like this in my windows form: SELECT workordernumber, date, firstname, lastname FROM customer_db; I am using a rich text box to display the data but it only...
4
by: A.M | last post by:
Hi, If I use System.Diagnostics.Debug.WriteLine in a asp.net application, where does the output go? Is there any trace monitor application thar shows me the trace output? Thanks, Allan
8
by: Mike | last post by:
In my Smart Device Project, I'm trying to show a message only when debugging. We used to be able to do this with Debug.Print in VB 6. I've tried System.Diagnostics.Debug.WriteLine and this...
3
by: Haldun ALIML | last post by:
Suppose that you have below property in some class, #if DEBUG public string DebugInfo { get { return "INDEX : " + _name + "\n" + "Index Owner : " + _owner.Name + "\n" + "Index Column Count:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.