By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,723 Members | 1,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,723 IT Pros & Developers. It's quick & easy.

System.Diagnostics.Debug.Assert();

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
> > 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 discussion thread is closed

Replies have been disabled for this discussion.