Simon Fell > Its just code : Sunday, June 09, 2002

Simon Fell > Its just code

Sunday, June 09, 2002

Now, here is a concept for all you bloggers and surfers of the world: next weekend - turn of your PC.  Leave it off for the whole weekend.  Have a life.  Visit your family.  Get some exercise.  Spend some time with human beings, face to face.  Its a lot more interesting than staring at a screen all day.  Trust me! [John Burkhardt] What, the whole weekend, all in one go, brrrrggghhhh, that's some cold turkey !
< 7:19:38 PM  # more elsewhere > Faithless - We Come 1 (Dave Clarke Remix)

I've posted a response to Sam's "Is Com Interop Fundamentally Flawed?" article. Hopefully this provides a unique look at the problem that not many other developers have supplied. [Drew's Blog] Ahhh Java/COM those were the days :). Its a pitty that not everything from Java/COM made it to .NET, in particular in Java/COM java classes that were serializable automagically got a COM implementation of IPersistStream.
< 1:15:21 PM  # more elsewhere > Faithless - We Come 1 (Hiver And Hammer Remix)

WSDL Wizard Beta 3 of the PocketSOAP WSDL Wizard 2.0 is now available for download.
< 10:53:21 AM  # more elsewhere > Orbital - Style (Single Version)

ROTFL
< 10:30:27 AM  # more elsewhere > Orbital - Nothing Left (Short Version)

more on Enum

Forget about the SOAP serialization for a second, but this actually seems more like a CLR problem to me. The runtime allowed the value 5 to be stored in a fooEnum value type. Heck, I just changed the method to do this:

return (fooEnum)5;

and it worked too. Looks like the testing the integral value upon cast for validity within the Enum is not there. So in the end I suppose they could add extra checks at the serialization layer, but it looks like the CLR is at fault for even allowing this assignment to take place. Then again, enums are just an abstract concept intended for compile time type checking. So if you do naughty things like this, maybe the compiler ought to be warning you? [Drew's Blog]

Well the fact that the cast is required indicates that its wrong, but you want to do it anyway. Drew pointed out in a later email that the original case of fooEnum.red | fooEnum.green on an enum with the System.Flags attribute is more much subtle, and less likely to get caught. The compiler ought to stop you doing bitwise operators on enums without the Flags attribute.


< 10:27:31 AM  # more elsewhere > Orbital - Nothing Left (Short Version)

Thanks to Fumiaki Yoshimatsu for emailing me to say that the System.Flags attribute should fix my issues with the enum below. I gave it a go, and it looks good, here’s the revised schema ASP.NET generates for fooEnum

<s:simpleType name="fooEnum">
 <s:list>
  <s:simpleType>
   <s:restriction base="s:string">
    <s:enumeration value="red" />
    <s:enumeration value="blue" />
    <s:enumeration value="green" />
   </s:restriction>
  </s:simpleType>
 </s:list>
</s:simpleType>

Calling getSomeFoo, now results in a response of “red green” so far so good. If I send a SOAP request, then I can also send “red green” and have it mapped back to fooEnum.red | fooEnum.green, cool. I do appear to have spotted what looks like a bug, in that if you try sending “red green” with the HTTP GET binding, it chokes with an error.
< 9:02:17 AM  # more elsewhere > Perfection - Believe In Me (Original Q Mix)