Browse by Tags

Tagged Content List
  • Blog Post: Why Doesn't C# Implement "Top Level" Methods?

    C# requires that every method be in some class, even if it is a static method in a static class in the global namespace. Other languages allow "top level" functions. A recent stackoverflow post asks why that is. I am asked "why doesn't C# implement feature X?" all the time. The answer is always the...
  • Blog Post: C# 3.0 is still statically typed, honest!

    Since LINQ was announced I've seen a lot of really positive feedback and a lot of questions and concerns. Keep 'em coming! We need this feedback so that we can both correct misconceptions early and get the design right now. One of the misconceptions that I've seen a lot over the last few days in forums...
  • Blog Post: Instance-bound nested classes in JScript .NET

    The other day someone asked me about a slightly odd but very useful feature in JScript.NET, and I figure if one person asks me about it, maybe more people want to know as well. In JScript.NET you can say class alpha { var foo; class bravo { function blah() { print (foo); } } } var x = new alpha...
  • Blog Post: Fun With Floating Point Arithmetic, Part Six

    One more thing -- I said earlier that the VBScript float-to-string algorithm was a little bit different than the JScript algorithm. We can demonstrate quite easily by comparing the outputs of two nigh-identical programs: ' VBScript print 9.2 * 100.0 < 920.0 print 919.9999999999999 < 920.0 print...
  • Blog Post: Fun with Floating Point Arithmetic, Part Five

    I went to Joel Spolsky's geek dinner at Crossroads the other night, which was a lot of fun. I didn't get much of a chance to chat with Joel, as he was surrounded by a cadre of adoring fans three deep the whole time. I mostly hung out with KC and Larry and some other attendees and had an interesting talk...
  • Blog Post: JScript .NET Type Coercion Semantics, Part Four: Coercion at last

    Before I get going, a couple notable milestones. First, this is post number 200 ! Who would have believed that I'd have so much to ramble on about? ("Anyone who knows you" would be the correct answer to that rhetorical question I suppose.) Second, as of Sunday I am now over (cue Dr. Evil...
  • Blog Post: JScript .NET Type Coercion Semantics, Part Three: Assignability

    Before I begin today's technical topic, a quick link to what promises to be a terrifying , I mean, terribly interesting blog. Mario , the guy who tests the code that I write and thereby keeps me honest, the guy who's application for a backyard barbecue was turned down by the Redmond fire department...
  • Blog Post: JScript .NET Type Coercion Semantics, Part Two: Promotability

    Last time I gave some vague, high-level definitions of the type system concepts promotable , assignable and coercible . Today I'll give a more precise definition of promotable . The others I'll define more precisely later. Suppose we have an assignment of an expression to a typed field. Left Hand...
  • Blog Post: JScript .NET Type Coercion Semantics

    Stan Lippman has started an interesting series of blog entries on how Managed C++ determines which function foo to call when you call foo(bar) given that there may be several visible functions of that name in the current scope. That's quite coincidental, as just the other day I was going through some...
  • Blog Post: A JScript .NET Design Donnybrook, Part Two

    I am totally amused that the comments on yesterday's entry are nigh-isomorphic to the argument that we had over this in October 2000. As noted, f.bar(f); does in fact call the base class function, not the derived class function as some might expect. I was on the fence back in 2000, but leaning towards...
  • Blog Post: A JScript .NET Design Donnybrook

    When you're designing a new programming language, the "main line" cases are easy. It's the "corner" cases that bedevil language designers -- the little fiddly bits where two language features that make perfect sense on their own interact in some weird way. Unfortunately, I suspect that any language sufficiently...
  • Blog Post: JScript .NET Classes Are Serializable -- Surprise!

    You learn something new every day in this job. Or, more accurately, some days you learn things again that you'd forgotten years ago. Someone just asked me why it is that all JScript .NET classes are serializable. I admit it, my first reaction was "They are?" But I checked the sources, wrote...
  • Blog Post: Eval is Evil, Part Three

    Recall that in Part One we discussed eval on the client, and in Part Two we discussed eval on the server. Today, I answer a question about eval in JScript .NET. S omeone sent me mail the other day asking why this C# program snippet didn't work: x = Microsoft.JScript.GlobalObject.eval("1");...
  • Blog Post: Virtual Methods and Brittle Base Classes

    Hey, I'm back! And in my new location. That was the longest and least relaxing vacation I've ever taken. Fun, yes. Relaxing, no. And to top it off, my kitchen is not done yet. We're shooting for being able to run water tonight and actually use appliances by tomorrow night, but we'll see how it goes...
  • Blog Post: The JScript Type System Part Eight: The Last Blog Entry About Arrays, I Promise

      Recall that I defined a type as consisting of two things: a set of values, and a rule for associating values outside of that set with values inside the set.   In JScript .NET, assigning a value outside of a type to a variable annotated with that type restriction does that coercion...
  • Blog Post: The JScript Type System Part Seven: Yeah, you've probably guessed that I wrote the array stuff

    A reader asked me to clarify a point made in an earlier entry:   Note that JScript .NET arrays do not have any of the methods or properties of a CLR array. (Strings, by contract, can be used implicitly as either JScript .NET strings or as System.String values, which I'll talk...
  • Blog Post: The JScript Type System, Part Six: Even more on arrays in JScript .NET

    You might have noticed something odd about that last example using SetValue . If you actually look up the method signature of SetValue in the CLR documentation it notes that the function signature is:   public function SetValue(value : Object, indices : int[]) : void ...
  • Blog Post: The JScript Type System, Part Five: More On Arrays In JScript .NET

    As I was saying the other day, CLR arrays and JScript arrays are totally different beasts. It is hard to imagine two things being so different and yet both called the same thing. Why did the CLR designers and the JScript designers start with the same desire -- create an array system -- and come up...
  • Blog Post: The JScript Type System, Part Four: JScript .NET Arrays

    As I mentioned in an earlier entry , one of the major differences between JScript .NET and JScript Classic is that JScript .NET now supports optional type annotations on variables.   The number of built-in primitive types has also increased dramatically.   JScript .NET adds value types...
  • Blog Post: The JScript Type System, Part One

    I thought I might spend a few days talking about the JScript and JScript .NET type systems, starting with some introductory material. Consider a JScript variable: var myVar; Now think about the possible values you could store in the variable. A variable may contain any number, any string...
  • Blog Post: Functions are not frames

    I just realized that on my list of features missing from JScript.NET "fast mode" I forgot about the caller property of functions.   In compatibility mode you can say   function foo(){bar();} function bar(){print(bar.caller);} foo();   ...
  • Blog Post: Global State On Servers Considered Harmful

    The other day I noted that extending the built-in objects in JScript .NET is no longer legal in "fast mode".   Of course, this is still legal in "compatibility mode" if you need it, but why did we take it out of fast mode?   As several readers have pointed out, this is...
  • Blog Post: JScript Goes All To Pieces

    My entry the other day about fast mode in JScript .NET sparked a number of questions which deserve fuller explanations. I’ll try to get to them in my next couple of blog entries. For example, when I said that it was no longer legal to redefine a function, I wasn’t really clear on what...
  • Blog Post: Compatibility vs. Performance

    Earlier I mentioned that two of the design goals for JScript .NET were high performance and compatibility with JScript Classic . Unfortunately these are somewhat contradictory goals! JScript Classic has many dynamic features which make generation of efficient code difficult. Many of these features...
  • Blog Post: Attention passengers: Flight 0703 is also known as Flight 451

    I hate octal.  Octal causes bugs.  I hate bugs, particularly stupid "gotcha" bugs.   Foolish C programmers do things like   int arr_flight = 0703;   not realizing that this does not assign the number 703, but rather 7 x...
Page 1 of 2 (29 items) 12