473,842 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Another C# critique

I have posted a C# critique at
http://www.heron-language.com/c-sharp-critique.html. To summarize I bring up
the following issues :

- unsafe code
- attributes
- garbage collection
- non-deterministic destructors
- Objects can't exist on the stack
- Type / Reference Types
- Boxing / Unboxing
- Mutability
- Classes as Modules and Programs
- Polymorphism through Class Inheritance
- Interface Delegation
- Interface Extensions
- C# Missing Template Template Parameters
- Late Added Generics
- Source File Layout
- Public Fields
- Special Primitives
- Is it a Property or is it a field?
- Microsoft

I am perhaps guilty somewhat of being a flame baiting troll, but at the same
time I honestly want to improve on the critique.

Thanks in advance for your responses.

--
Christopher Diggins
yet another language designer
http://www.heron-language.com
Nov 15 '05
188 7282
"Magnus Lidbom" <ma***********@ hotmail.com> wrote in
news:bv******** ****@ID-204195.news.uni-berlin.de:
"Frans Bouma" <pe************ ******@xs4all.n l> wrote in message
news:Xn******** *************** **********@207. 46.248.16...
>> in 2 different paradigms: selfservicing and adapter. Selfservicing
>> contains persistence info per entity. adapter uses a central
>> repository for that. Selfservicing requires this info in the entity
>> because it has to be able to execute code like this:
>>
>> CustomerEntity customer = new CustomerEntity( "CHOPS");
> It requires that the information be available to the class. Not that
> it be duplicated for each instance.


if you want to store it physically into a variable, it has to.

Why not use a static field for this and an instance field only for when
the default mapping is overridden?


would have been a good solution indeed.
>> However I don't see why it would result in huge memory problems.
> Huge is subjective. When a class uses an order of magnitude more
> memory per instance I call that huge.
>
> class UserPermission
> {
> private User m_user;
> private SecurityObject m_object;
> private SecurityLevel m_level;
> //methods and properties
> }
>
> I'd expect a UserPermission instance itself to occupy not much more
> than 12 bytes of memory since all fields are references to objects
> shared by many UserPermission instances. I'd expect the mapping
> information to occupy hundreds of bytes.


Ok, that's also the case here, I was talking about the mapping info
for the entity fields, like Customer's fields: CustomerID, ContactName
etc.

I'm not sure I understand you. The fields in the above class are entity
fields. At least by my, context dependent, definitions of entity. Namely
a mapped class.


Ah I now understand :) Ok, I consider these fields as members
holding references to related objects, and these relations are coded in
code, not stored into mapping data held somewhere. the only mapping data I
store in every entity (in one template set) is the table field mappings.
Mappings of relations are stored in code via static classes and via
methods. (so myCustomer.Orde rs fetches lazy loaded all orders related to
myCustomer on the fly, through the generated code.). Indeed, if you do not
generate code you have to keep that info somewhere, it was a
misunderstandin g indeed :) I dont' keep that data around.

FB
Nov 15 '05 #171

"Frans Bouma" <pe************ ******@xs4all.n l> wrote in message
news:Xn******** *************** **********@207. 46.248.16...
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
news:Oe******** ******@TK2MSFTN GP10.phx.gbl:
"Frans Bouma" <pe************ ******@xs4all.n l> wrote in message
news:Xn******** *************** **********@207. 46.248.16...
I don't see why not. It's compiler sugar. C++'s const can be
compiled into C code, a language which doesn't contain const. I don't
see why ToString() has any importance in this though. :) It doesn't
alter anything, it just transfers a value to a string format which is
returned, the actual value isn't altered.


Thats the point, ToString() is *NOT* const, its a non-const method.


I know, but that's not too interesting, is it? :) I mean: it
produces a new value, from the old value, it doesn't change the old value,
therefore isn't altering the old value which is constant. I mean this is
also good code:

// foo.Bar is const
int i = foo.Bar;
i++;

I see that as the same as:
string bar = foo.Bar.ToStrin g();

But perhaps we have a misunderstandin g going on somewhere ;)
Meaning you would haveto cast const-ness away to use it. Thats the
annoyance I'm trying to get at.


You have to explain to me why because I don't see this. It's my
understanding that ToString() always produces a new value, so I don't see
why I need to cast away const to be able to use it.


What I mean, is by my understanding on a const reference to an object, you
can *only* call const methods(otherwi se I see little need for a const
modifier, just document it in comments). Without modifying the BCL,
ToString() would not be a const method and be an illegal call. The method
itself *is* const, atleast the default implementation, but the method
signature doesn't guarentee that, meaning that there is no contractual
binding to be const and to the runtime, compilers, and everyone in general
ToString() would effectivly be a non-const method. I wouldn't support or use
a const implementation that simply guessed as to the const-ness of a
method(even by static IL analysis), I want contractual restrictions to that
effect. Such a system would be acceptable to interop with the fringe
case(Cobol or ML maybe), but shouldn't be in C#, VB, Delphi, or C++.
Please correct me if my understanding of const methods is wrong in this
respect.
While I agree is compiler sugar, I just think its next to useless if it
is only applicable in one language out of many that *could* source the
code. Exposing it as a bit of metadata markup is one thing, you actually
could write static tools to verify this if you were enterprising enough,
but really integrating it into the language and the runtime is something
else. I don't feel that its proper to just start cramming things in as
"compiler sugar" at this point. I would rather see a clean, well thought
out implementation in V5 instead of a hacked, half-assed one in V3.
Remeber, once it goes in, it can never come back out.


I agree that if C# has 'const' and VB.NET doesn't, it's pretty moot
to mark a property's value as const in C# while you can keep altering it
in VB.NET.

However what's the problem by having it in the CLR? Say const
exists and I have this code in class object myBar:

public const Foo MyFoo
{
get { return _myFoo; }
}

Now, when I do this in C#:
Foo bla = myBar.MyFoo;

I can't alter bla's data, because it is const. Now if I do it in
VB.NET:
Dim bla As Foo = myBar.MyFoo

and say, VB.NET doesn't support const and const would be introduced
as a compiler check, the VB.NET developer would be able to alter bla's
data because VB.NET doesn't know of const, and I agree, this is an issue
with compiler-only const checks, so it's not that valuable.

However, if it is placed in the CLR, the CLR could then throw an
exception if the VB.NETdeveloper does this:

bla.MyProperty = newValue

then, although VB.NET doesn't know const, the CLR can forbid the
alternation of that property because bla is const. You can argue that this
is a bad thing, but why would it be a bad thing? I don't see it. The
developer of Bar clearly stated that MyFoo is a const property, and did
that on purpose. Even though VB.NET doesn't understand const, it can't
alter the object, simple as that.

The though thing now is: how does the VB.NET developer know MyFoo
is a const property? This is, I think an issue of documentation. I mean,
if there is no set clause in a property, setting it to a value also gives
an error.

FB
--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma

Nov 15 '05 #172
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
news:#T******** ******@TK2MSFTN GP09.phx.gbl:
"Frans Bouma" <pe************ ******@xs4all.n l> wrote in message
news:Xn******** *************** **********@207. 46.248.16...
You have to explain to me why because I don't see this. It's my
understanding that ToString() always produces a new value, so I don't
see why I need to cast away const to be able to use it.


What I mean, is by my understanding on a const reference to an object,
you can *only* call const methods(otherwi se I see little need for a
const modifier, just document it in comments).


In C++ this seems to be the case, if I understand it correctly
(haven't programmed real harcore C++ in years, just C/C++ mix). However
why would C++'s syntaxis be the base of how const should be implemented?
After all, as I see it, the restriction of being able to call only const
methods on a const object is done because that's the only way you can
properly check at compiletime in a reasonable amount of time if a method
really alters the object (and thus violates the contract) or not.

Now, I think there are a couple of reasons people want 'const'
object references: to be sure their code is cost correct, and for example
to be sure no-one alters the returned object reference.

Const correctness can only be guaranteed at compiletime, IMHO, if
you restrict calls to const methods only, on a const object. At runtime,
the CLR can check for const correctness via exceptions. The latter should
be enough for people who don't want other code to alter an object (tree)
which is returned by a method.

I think giving this choice like an OPTION STRICT kind of setting
for the compiler can satisfy every developer. True, you can't call
ToString() if you want to have compile time const-checking, however it
might be possible to let the compiler check if the code inside ToString()
is harmful to the object or not. (however this might be pretty complex)

FB

--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Nov 15 '05 #173

"Frans Bouma" <pe************ ******@xs4all.n l> wrote in message
news:Xn******** *************** **********@207. 46.248.16...
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
news:#T******** ******@TK2MSFTN GP09.phx.gbl:
"Frans Bouma" <pe************ ******@xs4all.n l> wrote in message
news:Xn******** *************** **********@207. 46.248.16...
You have to explain to me why because I don't see this. It's my
understanding that ToString() always produces a new value, so I don't
see why I need to cast away const to be able to use it.

What I mean, is by my understanding on a const reference to an object,
you can *only* call const methods(otherwi se I see little need for a
const modifier, just document it in comments).


In C++ this seems to be the case, if I understand it correctly
(haven't programmed real harcore C++ in years, just C/C++ mix). However
why would C++'s syntaxis be the base of how const should be implemented?
After all, as I see it, the restriction of being able to call only const
methods on a const object is done because that's the only way you can
properly check at compiletime in a reasonable amount of time if a method
really alters the object (and thus violates the contract) or not.

Havn't really done much C++ myself in some time, I disliked the C++
inheritence model to the point I wouldn't use it. I was happier working
procedurally. However, as far as the const model goes I think its a
reasonable choice. Const-ness should be a contract, not a runtime determined
property. Now, I think there are a couple of reasons people want 'const'
object references: to be sure their code is cost correct, and for example
to be sure no-one alters the returned object reference.

Const correctness can only be guaranteed at compiletime, IMHO, if
you restrict calls to const methods only, on a const object. At runtime,
the CLR can check for const correctness via exceptions. The latter should
be enough for people who don't want other code to alter an object (tree)
which is returned by a method.

I think giving this choice like an OPTION STRICT kind of setting
for the compiler can satisfy every developer. True, you can't call
ToString() if you want to have compile time const-checking, however it
might be possible to let the compiler check if the code inside ToString()
is harmful to the object or not. (however this might be pretty complex)
As I was discussing with Magnus, it would be possible although it would
*need* to be done in some compiler agnostic manner. The code would be
complex enough that forcing every compiler writer who is interested in
constness to implement the whole feature set would be absurd, so either a
compile time tool, preferably via compiler extensions, or a runtime
extension mechanism that would allow verification services *could* do
it(probably both would be ideal), however I think a deeply baked-in solution
would be much more appropriate and complete.

FB

--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma

Nov 15 '05 #174

"Frans Bouma" <pe************ ******@xs4all.n l> wrote in message
news:Xn******** *************** **********@207. 46.248.16...
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
news:#T******** ******@TK2MSFTN GP09.phx.gbl:
"Frans Bouma" <pe************ ******@xs4all.n l> wrote in message
news:Xn******** *************** **********@207. 46.248.16...
You have to explain to me why because I don't see this. It's my
understanding that ToString() always produces a new value, so I don't
see why I need to cast away const to be able to use it.

What I mean, is by my understanding on a const reference to an object,
you can *only* call const methods(otherwi se I see little need for a
const modifier, just document it in comments).


In C++ this seems to be the case, if I understand it correctly

Casting barred, your understanding is correct.

<snip>
Const correctness can only be guaranteed at compiletime, IMHO, if
you restrict calls to const methods only, on a const object.
At runtime,
the CLR can check for const correctness via exceptions. The latter should
be enough for people who don't want other code to alter an object (tree)
which is returned by a method.
I think giving this choice like an OPTION STRICT kind of setting
for the compiler can satisfy every developer. True, you can't call
ToString() if you want to have compile time const-checking, however it
might be possible to let the compiler check if the code inside ToString()
is harmful to the object or not. (however this might be pretty complex)


I don't believe implementing it that way would be a good idea. If a method
is not const, that is a statement from the implementer that this method may
alter the state of the instance it is invoked on, even if it doesn't in it's
current implementation. Invoking that method on a const reference is a
breach of contract and should be disallowed except if an explcit cast is
applied.

If you take a look at the subthread above this one, you'll find a discussion
of a potential compile time mechanism that could supply checking of const
even for languages that do not themselves support const It could also supply
as a compiler switch that would allow for gradual introduction of const into
existing code without breakage. The latter would be accomplished by using
the same checks used for non supporting languages instead of a stricter
enforcement of const. Not entirely unlike your idea. In theory, the changes
could be made without any modifications to the CLS. Whether that would be
appropriate is another matter altogther though. The point is that it's not a
change that would break existing compilers.

Regards /Magnus Lidbom


Nov 15 '05 #175
On Wed, 4 Feb 2004 07:06:06 -0600, "Daniel O'Connell [C# MVP]"
<onyxkirx@--NOSPAM--comcast.net> wrote:

"Frans Bouma" <pe************ ******@xs4all.n l> wrote in message
news:Xn******* *************** ***********@207 .46.248.16...
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
news:#T******** ******@TK2MSFTN GP09.phx.gbl:
> "Frans Bouma" <pe************ ******@xs4all.n l> wrote in message
> news:Xn******** *************** **********@207. 46.248.16...

<snip>
Const correctness can only be guaranteed at compiletime, IMHO, if
you restrict calls to const methods only, on a const object. At runtime,
the CLR can check for const correctness via exceptions. The latter should
be enough for people who don't want other code to alter an object (tree)
which is returned by a method.

I think giving this choice like an OPTION STRICT kind of setting
for the compiler can satisfy every developer. True, you can't call
ToString() if you want to have compile time const-checking, however it
might be possible to let the compiler check if the code inside ToString()
is harmful to the object or not. (however this might be pretty complex)


As I was discussing with Magnus, it would be possible although it would
*need* to be done in some compiler agnostic manner.


<snip>

Seems I've failed to make myself clear. I never intended for the
mechanism to perform that type of code analysis. In fact, I don't feel
that would be appropriate as it would allow for contracts to be
violated. What I intended for the validation to check was that the
contract wasn't breached by code in languages that do not themselves
support const:

//const supporting assembly
class Foo
{
private int m_value;
public static const Foo GetInstance(){r eturn new Foo();}
public int Value
{
//declare get const.
get const
{
return m_value;
}
set
{
m_value = value;
}
}
}

//non-supporting assembly. Oddly enough still C#.
class Bar
{
public void FooBar()
{
//Ok, even though myFoo is not declared const, since
//it's a non supporting language. A compiler switch could
//enable this behaviour in supporting languages to ease
//introduction of const correctness into existing code.
//Valid code in a supporting assembly would be:
//const myFoo = Foo.Getinstance ();
Foo myFoo = Foo.Getinstance ();

//OK.
Console.WriteLi ne(myFoo.Value) ;

//Validation fails at compile time.
myFoo.Value = 5;
}
}

Regards /Magnus Lidbom

Nov 15 '05 #176
On Wed, 04 Feb 2004 16:58:49 +0100, Magnus Lidbom
<ma***********@ hotmail.com> wrote:

<snip>
//non-supporting assembly. Oddly enough still C#.
class Bar
{
public void FooBar()
{
//Ok, even though myFoo is not declared const, since
//it's a non supporting language. A compiler switch could
//enable this behaviour in supporting languages to ease
//introduction of const correctness into existing code.
//Valid code in a supporting assembly would be:
//const myFoo = Foo.Getinstance ();

This should of course be:
const Foo myFoo = Foo.GetInstance ();

/Magnus Lidbom
Nov 15 '05 #177
On Wed, 4 Feb 2004 03:41:31 -0600, "Daniel O'Connell [C# MVP]"
<onyxkirx@--NOSPAM--comcast.net> wrote:

"Magnus Lidbom" <ma***********@ hotmail.com> wrote in message
news:bv******* *****@ID-204195.news.uni-berlin.de...

"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:Oe******** ******@tk2msftn gp13.phx.gbl...
<snip>
This may be a case where the technical
aspect is surmountable while the political one isn't. Convincing the
ECMA
or
> Microsoft that const is important would be the bigger problem.


It may well be. But unless we're missing something the only meaningful
argument against const I've heard so far seems to be void. Maybe this
solution hasn't occurred to the C# team. After all, it is rather

unorthodox.
If the decision to forgo const was made assuming that const would be
guraranteed to break language interoperabilit y and that introducing const
correct code would cause severe code breakage along the way, then this
solution, if feasable, just might make them reconsider.

It might, I'm certain someone from MS is reading this, even if they don't
respond. We'll see if it ever flys anywhere. Of course approaching MS and
the EMCA would be another choice.

If I had the time necessary to do the research and preparation I
might be tempted to try that. However, my knowledge of compilers is
nowhere near to being up to the task, so it would take quite some time
upgrading that first and then researching this in particular. As is,
finding time for these posts is about what I can manage.

The rotor const implementation is
something else, inclusions in rotor are more likely to be considered(for
one, MS Employees can look at the source to rotor, I don't think they can't
look at OSS source in their area and I don't know if they can use OSS produc
ts). An examiniation of that would probably yield fruitful as well.
Unfortunate that the C# compiler is in C++ however, I'd rather not go back
to using C++ for anything I can avoid, ;).
Anyway, it also gives rise to an idea that I don't think the framework
currently supports. If the framework was extended to the point where it was
possible to plug in verification units into the run time, something that can
run just before the JIT'er and do analysis on IL on the method being JIT'ed,
such protections and other issues may be additionally avoidable. It would be
a performance issue, to some extent, but as it would only analyze each
method just before the JIT work is done, it would be faster than a scan
before every execution and could be disabled by running ngen for apps with a
vital startup speed. It would be interesting, and an extension point I'd
very much like to see, atleast experimentally. That would be a very interesting capability indeed.
In the case of a const implementation I'd prefer compile time
validation for all languages though.
I really do need to suck it
up and take a look at rotor, see if such a mechanism is possible.

If you could find the time to do that it would be great :)
Regards /Magnus Lidbom
Nov 15 '05 #178

"Magnus Lidbom" <ma***********@ hotmail.com> wrote in message
news:d7******** *************** *********@4ax.c om...
On Wed, 4 Feb 2004 07:06:06 -0600, "Daniel O'Connell [C# MVP]"
<onyxkirx@--NOSPAM--comcast.net> wrote:

"Frans Bouma" <pe************ ******@xs4all.n l> wrote in message
news:Xn******* *************** ***********@207 .46.248.16...
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
news:#T******** ******@TK2MSFTN GP09.phx.gbl:
> "Frans Bouma" <pe************ ******@xs4all.n l> wrote in message
> news:Xn******** *************** **********@207. 46.248.16...
<snip>
Const correctness can only be guaranteed at compiletime, IMHO, if
you restrict calls to const methods only, on a const object. At runtime, the CLR can check for const correctness via exceptions. The latter should be enough for people who don't want other code to alter an object (tree) which is returned by a method.

I think giving this choice like an OPTION STRICT kind of setting
for the compiler can satisfy every developer. True, you can't call
ToString() if you want to have compile time const-checking, however it
might be possible to let the compiler check if the code inside ToString() is harmful to the object or not. (however this might be pretty complex)
As I was discussing with Magnus, it would be possible although it would
*need* to be done in some compiler agnostic manner.


<snip>

Seems I've failed to make myself clear. I never intended for the
mechanism to perform that type of code analysis. In fact, I don't feel
that would be appropriate as it would allow for contracts to be
violated. What I intended for the validation to check was that the
contract wasn't breached by code in languages that do not themselves
support const:

//const supporting assembly
class Foo
{
private int m_value;
public static const Foo GetInstance(){r eturn new Foo();}
public int Value
{
//declare get const.
get const
{
return m_value;
}
set
{
m_value = value;
}
}
}

//non-supporting assembly. Oddly enough still C#.
class Bar
{
public void FooBar()
{
//Ok, even though myFoo is not declared const, since
//it's a non supporting language. A compiler switch could
//enable this behaviour in supporting languages to ease
//introduction of const correctness into existing code.
//Valid code in a supporting assembly would be:
//const myFoo = Foo.Getinstance ();
Foo myFoo = Foo.Getinstance ();

//OK.
Console.WriteLi ne(myFoo.Value) ;

//Validation fails at compile time.
myFoo.Value = 5;
}
}

Which is basically what I mean, *I think*, just simply that it would be an
external tool of some sort that does the analysis, instead of requiring the
compiler to do it, that would have two effects, 1) it would be possible for
all compilers to behave correctly without adding alot of extra code and 2)
you could verify const correctness of code yourself. In an environment where
const doesn't exist in the first class it won't be possible to ensure 100%
that code is const correct without doing a full static analysis of the IL.
The above code, as I read it, makes it impossible for languages that don't
use const to use non-const methods on objects. If for no reason other than
it not being possible to apply metadata to an instance. Beyond that,
tracking references would be next to impossible. If that Foo was placed in a
hash table or array list, I very much doubt the compiler could keep track of
it...thinking about it now I am not sure that a static tool could either, so
this whole approach may not be feasible. Now, therun time on the other hand
probably could, but again not without some changes to the system.
This could be solved at some point, I've been working on a mechanism(still
playing with syntax) for attaching attributes to an instance of an object at
runtime. Such a feature could, instead of making a const reference or
variable, be used to make a const instance, which would provide a much more
flexible approach to cross language issues than static tools and relying on
a const return attribute. It'd also make it harder to remove const, if you
deny untrusted code permission to modify the attribute set on an instance,
that code couldn't remove const and cause trouble. It would also allow the
runtime to easily detect if an instance is currently const and if you can
modify it.
However, the downsides are that a method could hold onto that instance
reference and use it sometime *after* the attribute has been removed. Regards /Magnus Lidbom

Nov 15 '05 #179

"Magnus Lidbom" <ma***********@ hotmail.com> wrote in message
news:0p******** *************** *********@4ax.c om...
On Wed, 4 Feb 2004 03:41:31 -0600, "Daniel O'Connell [C# MVP]"
<onyxkirx@--NOSPAM--comcast.net> wrote:

"Magnus Lidbom" <ma***********@ hotmail.com> wrote in message
news:bv******* *****@ID-204195.news.uni-berlin.de...

"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:Oe******** ******@tk2msftn gp13.phx.gbl...
<snip>
This may be a case where the technical
aspect is surmountable while the political one isn't. Convincing theECMA
or
> Microsoft that const is important would be the bigger problem.

It may well be. But unless we're missing something the only meaningful
argument against const I've heard so far seems to be void. Maybe this
solution hasn't occurred to the C# team. After all, it is rather

unorthodox.
If the decision to forgo const was made assuming that const would be
guraranteed to break language interoperabilit y and that introducing const correct code would cause severe code breakage along the way, then this
solution, if feasable, just might make them reconsider.

It might, I'm certain someone from MS is reading this, even if they don't
respond. We'll see if it ever flys anywhere. Of course approaching MS and
the EMCA would be another choice.

If I had the time necessary to do the research and preparation I
might be tempted to try that. However, my knowledge of compilers is
nowhere near to being up to the task, so it would take quite some time
upgrading that first and then researching this in particular. As is,
finding time for these posts is about what I can manage.

The rotor const implementation is
something else, inclusions in rotor are more likely to be considered(for
one, MS Employees can look at the source to rotor, I don't think they can'tlook at OSS source in their area and I don't know if they can use OSS products). An examiniation of that would probably yield fruitful as well.
Unfortunate that the C# compiler is in C++ however, I'd rather not go backto using C++ for anything I can avoid, ;).
Anyway, it also gives rise to an idea that I don't think the framework
currently supports. If the framework was extended to the point where it waspossible to plug in verification units into the run time, something that canrun just before the JIT'er and do analysis on IL on the method being JIT'ed,such protections and other issues may be additionally avoidable. It would bea performance issue, to some extent, but as it would only analyze each
method just before the JIT work is done, it would be faster than a scan
before every execution and could be disabled by running ngen for apps with avital startup speed. It would be interesting, and an extension point I'd
very much like to see, atleast experimentally.

That would be a very interesting capability indeed.
In the case of a const implementation I'd prefer compile time
validation for all languages though.

As would I, however I don't think a backup runtime validation would
nessecerily be a bad thing. It would keep sneaky IL attacks, etc at bay.
I really do need to suck it
up and take a look at rotor, see if such a mechanism is possible. If you could find the time to do that it would be great :)


At the moment I am currently working with mono's c# compiler(I really prefer
working in C#, so its C# Compiler In C# is a rather nice place to play, ;))
and have added a few basic language features to it, mainly to start to
familiarize myself with compilers. But I do have time and I will grab rotor
and a few other bits and see waht I can figure out(only thing I hate about
rotor is that I have to install perl). As I work on compilers and the
language I try to post on my blog[1] about whatever I've added(and hopefully
links to patches soon as well), so assuming I can figure out how to do this
I'll be posting information there. I will reply here of course, but it may
be a while before anything serious works and it may be easier to find
there(this thread will fade away soon enough).

1. http://dotnetjunkies.com/weblog/doconnell/

Regards /Magnus Lidbom

Nov 15 '05 #180

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

Similar topics

14
3749
by: Long | last post by:
How to include an HTML doc in another HTML doc Problem: to insert the body section of an HTML doc in another HTML document at a specific location. One possible way is to add a WebCharm tag like this: <%@charm:html 20 0 my_services.htm %> When the HTML template is processed by a WebCharm-aware web server, the
19
2561
by: TC | last post by:
Are there any good sites or forums for a web critique? I went to alt.html.critique and it's pretty dead.
9
2290
by: bowsayge | last post by:
Inspired by fb, Bowsayge decided to write a decimal integer to binary string converter. Perhaps some of the experienced C programmers here can critique it. It allocates probably way too much memory, but it should certainly handle 64-bit cpus :) #include <stdio.h> #include <stdlib.h> char * to_binary (unsigned long value) {
39
1947
by: Eric | last post by:
There is a VB.NET critique on the following page: http://www.vb7-critique.741.com/ for those who are interested. Feel free to take a look and share your thoughts. Cheers, Eric. Ps: for those on comp.programming, this may be off topic, but I've posted there because the critique was part of a discussion in that group.
0
9870
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9715
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10942
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10671
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9452
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7035
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5884
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4499
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3142
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.