[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: .NET CLR? was no subject



I've been looking at the CLR, trying to decide if it can reasonably
support a Dylan/Proto-like language.  So here are some rough answers to
your questions.

For better answers, talk to David Simmons who (1) is a serious VM guru,
(2) knows quite a bit about the CLR, and (3) is on this list.

On Wed, 2002-03-06 at 11:10, Ken Anderson wrote:
> However, http://www.javalobby.org/clr.html suggests that a language, say L, 
> becomes L#, a hybrid langauge, with C# warts or performance 
> limitations.  The article even quotes David Simmons about Smallscript.

The javalobby page is of uncertain accuracy at best.  For example:

| The result: Dialects that cripple the original languages to become
| CLR-compatible. Examples are Managed C++ and Eiffel#, both not
| supporting implementation MI.

Bertrand Meyer, on the other hand, claims that current versions of
Eiffel# supports multiple inheritance, generic types, and design by
contract:

http://eiffel.com/doc/manuals/technology/bmarticles/sd/dotnet.html

I've also ordered the following book, which claims to discuss various
approaches for implementing multiple inheritance on the CLR:

http://www.pearsonptg.com/book_detail/0,3771,0130622966,00.html

If I have time, I'll write a review of the book when it arrives.

> How good is this metadata idea?

Quite nice, actually, if your language also supports introspection. 
Here's a short code snippet from Cook Computing's XML-RPC.NET web site (
http://www.cookcomputing.com/xmlrpc/ ), demonstrating a simple XML-RPC
server.  The XML-RPC.NET runtime uses metadata to control how objects
get exported to the web: 

| public class BettyService : XmlRpcService
| {
|     [XmlRpcMethod("examples.getStateName",
|      Description="Return name of state given its number")]
|     public string getStateName(int stateNum)
|     {
|         if (stateNum == 41)
|             return "South Dakota";
|         else
|             return "Don't know";
|     }
| }

To register this service, you need only the following configuration
file:

| <configuration>
|   <system.web>
|     <httpHandlers>
|       <add verb="*" path="betty.xmlrpc"
|          type="CookComputing.BettyService, bettyservice" />
|     </httpHandlers>
|   </system.web>
| </configuration>

The server examines the BettyService class using introspection, and
exports any methods with the XmlRpcMethod attribute.

Writing a similar program in Java requires the abuse of 'public static
final' methods to fake attributes:

http://xmlrpc-c.sourceforge.net/hacks/SampleServer.java

Also, the Mono project ( http://www.go-mono.com/ ) uses attributes to
mark unfinished code:

| [MonoTODO]
| public override Type DeclaringType {
|     get {
|         throw new NotImplementedException ();
|     }
| }

A small C# program uses introspection to extract this information and
generate the following list of unfinished classes (IE 6 or recent
Mozilla required):

http://www.go-mono.com/class-status.html

So, all in all, attributes seem like a fairly useful language feature,
especially if you want to build lots of automatic tools.

If you want to look into CLR support for Linux, check out the following
web sites:

http://mail.gnome.org/archives/gnome-hackers/2002-February/msg00031.html
http://www.go-mono.com/
http://www.southern-storm.com.au/portable_net.html

That's more or less what I know about the CLR. :-)  Would anybody else
here like the share their experiences with CLR?

Cheers,
Eric