NETLink - CREATING a new class?
- To: mathgroup at smc.vnet.net
- Subject: [mg45085] NETLink - CREATING a new class?
- From: ToolmakerSteve at shawstudio.com (ToolmakerSteve)
- Date: Tue, 16 Dec 2003 06:21:16 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Background: I've read the early NETLink docs, as well as the JavaLink docs. I am familiar with modern OO environments [Eiffel, Java, C++, Lisp/CLOS, ScriptX, Beta] and functional environments [Mathematica, Haskell, ML]. Question: Is it possible to COMPLETELY do .NET programming from within Mathematica? [And ultimately, to write an interactive .NET programming tool inside Mathematica, that would convert my mathematically-rigorous representation of algorithms into .NET code, that could be analyzed from Mathematica.] Never touch C#, yet accomplish the following: 1. Create new types (abstract interfaces) and new classes. The hard part: these must INHERIT from fundamental classes provided in the .NET Common Language Runtime (CLR). 2. Add methods to those classes. Ambiguous whether I mean that the methods are running on Mathematica Kernel or inside NET/CLR using MSIL. Ideally, some methods would be on one, some on the other -- that is, during debugging, could replace a NET/MSIL method with a callback into Math'a. [Obscure Tech Details: CLR's Profiler interface has logic to force a method to be re-JIT'ed, and a hook by which a program could supply a new Sequence of CLR byte-codes as the method body; use this to inject a callback into Math'a, with some unique identifier to indicate WHICH method is being called...] 3. Create new objects, query and change the fields on those objects. Yes, This is what NET/Link provides. 4. Managing references to NET objects. Yes, "KeepNETObject" and "ReleaseNETObject". Question: If one has one NET object ("A"), that refers to other NET objects, is it sufficient to Keep/Release "A"? In particular, consider an "A" that is a collection of objects that are used by a given document or computation - I would create and Keep an empty "A" as each document is opened; that "A" would be filled as the document details are read in / or as a user creates them; when that document is closed I would Release "A" - I don't want to have to manage any other references but that one. NOTE: Can't use NETBlock, because the document lives in its own modeless window - multiple documents might be simultaneously open. - - - - - In summary, I have questions about Mathematica as a .NET programming environment; (3) will surely be covered well by documentation as it is created, but that is only the tip of what a .NET programmer can do - kind of like Visual Basic before .NET came along - "Object-Oriented" in the limited sense of making method calls on existing classes, but not a real O-O environment, because couldn't create -and inherit- new classes; cannot extend a concept by subclassing it; no notion of "abstract types" (Interfaces). if NET/Link makes Mathematica capable of more than that, then I would love to see examples of how to do so! -- ToolmakerSteve
- Follow-Ups:
- Re: NETLink - CREATING a new class?
- From: "Werner Schuster" <werner.schuster@netway.at>
- Re: NETLink - CREATING a new class?