www.digitalmars.com         C & C++   DMDScript  

D - Vault Language from Microsoft Research

reply Mark Evans <Mark_member pathlink.com> writes:
http://research.microsoft.com/vault/

Sounds like a D ripoff:

"Today's safe programming languages, like C#, are great for weeding out many
bugs in programs. Unfortunately, such languages are not suited to programmers
who want to control the memory layout of their data structures or the lifetime
of program's resources (like memory). Programmers who need this control are
stuck with C or C++. Vault is a safe version of the C programming language,
being developed at Microsoft Research, which provides the same level of safety
as languages like C#, but allows a programmer to retain control over data layout
and lifetime."
Feb 18 2003
next sibling parent reply Dan Liebgold <Dan_member pathlink.com> writes:
This language (Vault) implements some interesting ideas with respect to first
class functions and closures.  Take the example (from
http://research.microsoft.com/vault/learn/tutorial/closures.htm):


void startLogging (char *logFilename) {
file_handle logfile = openFile(logFilename, "a");
registerInterruptHandler(
12, 
void (int interrupt) {
writeMessage(interrupt, logfile);
}
);
}

So the second parameters of "registerInterruptHandler" is an anonymous function.
That capability alone would bring enormous benefit to D.  I imagine in D's
implementation the type of this construct would actually be a delegate. 

Usually the two components of a delegate are the function pointer and the owning
class instance. To support this usage, delegates would also be extended (by
adding another pointer) to point to their enclosing scope/environment as well,
thereby implenting closures. In the above example the closure would contain the
"logfile" local variable.  Since D is garbage collected, the environment could
be just another allocated and collected object, with the only things referring
to them being closures contained therein.

Any thoughts?

Dan



In article <b2v911$1ukq$1 digitaldaemon.com>, Mark Evans says...
http://research.microsoft.com/vault/

Sounds like a D ripoff:

Feb 19 2003
next sibling parent reply "Walter" <walter digitalmars.com> writes:
"Dan Liebgold" <Dan_member pathlink.com> wrote in message
news:b30v5g$n0k$1 digitaldaemon.com...
 Usually the two components of a delegate are the function pointer and the

 class instance. To support this usage, delegates would also be extended

 adding another pointer) to point to their enclosing scope/environment as

 thereby implenting closures. In the above example the closure would

 "logfile" local variable.  Since D is garbage collected, the environment

 be just another allocated and collected object, with the only things

 to them being closures contained therein.

Being able to access enclosing locals within the closure is a major increase in implementation complexity, I'd prefer to avoid that <g>.
Feb 19 2003
parent Burton Radons <loth users.sourceforge.net> writes:
Walter wrote:
 Being able to access enclosing locals within the closure is a major increase
 in implementation complexity, I'd prefer to avoid that <g>.

No it isn't. I just implemented both nested functions and nested functions that can refer to the parent scope in about twenty minutes in my compiler. Maybe this situation is different in DMD, but that's your problem - the language shouldn't be punished just because its first implementation is a converted C++ compiler. This is excluding multiple nesting, of course, like this: void baz () { int x; void foo () { void bar () { printf ("%d\n", x); } bar (); } } There's no good reason to support this.
Feb 20 2003
prev sibling parent Burton Radons <loth users.sourceforge.net> writes:
Dan Liebgold wrote:
 Usually the two components of a delegate are the function pointer and the
owning
 class instance. To support this usage, delegates would also be extended (by
 adding another pointer) to point to their enclosing scope/environment as well,
 thereby implenting closures. In the above example the closure would contain the
 "logfile" local variable.  Since D is garbage collected, the environment could
 be just another allocated and collected object, with the only things referring
 to them being closures contained therein.

The third pointer is not necessary, just the function pointer and the "this". In the case of nested functions, the "this" points to the nesting function scope. From there you can get the real "this" pointer if necessary and if it's present. If it turns out to be an efficiency loss, the actual "this" pointer could be unpacked into a local at the start of the nested function.
Feb 20 2003
prev sibling next sibling parent reply Mark T <Mark_member pathlink.com> writes:
In article <b2v911$1ukq$1 digitaldaemon.com>, Mark Evans says...
http://research.microsoft.com/vault/

Sounds like a D ripoff:

Since I became aware of this language (Vault) in July 2001, I doubt that it is a "ripoff", probably the same with the Cyclone language. I think many people are disappointed with C++ and Java for various reasons and like to research alternatives. The difference with D, it seems, is that it is intended for real use. From my perspective, I hope it becomes popular enough that cross-compiler vendors start picking up on it so I can use it at work (embedded systems).
Feb 21 2003
next sibling parent "Walter" <walter digitalmars.com> writes:
"Mark T" <Mark_member pathlink.com> wrote in message
news:b35a25$1fvp$1 digitaldaemon.com...
 The difference with D, it seems, is that it is intended for real
 use.

Yes. How many of those other languages support inline assembler? <g>
 From my perspective, I hope it becomes popular enough that cross-compiler
 vendors start picking up on it so I can use it at work (embedded systems).

It's always worthwhile to email those vendors and ask them if they support D. Of course they'll say no, and will say they have no plans to. People won't adopt D the first time they hear of it, nor the second time, nor the third time. But eventually, they will keep hearing enough about D to be convinced that it is a real language here to stay, and they should be checking it out.
Feb 21 2003
prev sibling parent Mark Evans <Mark_member pathlink.com> writes:
I doubt that it is a "ripoff", probably the same with the Cyclone language.

You missed the humor. I was trying to be facetious in communicating the fact that Vault and D are extremely close in their goals and design philosophy. (Of course it is not a ripoff!) Microsoft is paying for that research work, and those guys have their research reputations on the line too. So I don't think they are interested in playing around. I first heard about D I don't know how many years ago now...... Mark
Feb 21 2003
prev sibling parent reply Farmer <itsFarmer. freenet.de> writes:
Mark Evans <Mark_member pathlink.com> wrote in
news:b2v911$1ukq$1 digitaldaemon.com: 

 
 http://research.microsoft.com/vault/
 

Great link ! Very interesting, especially if your browser ignores <COMMENT> tags like Opera does. <g> I wonder what <COMMENT> tags, there would be in the D spec, if Walter was not clever enough to remove them from the puplic D spec ;-) Farmer
Feb 26 2003
parent "Walter" <walter digitalmars.com> writes:
You can view the <comment> tags in explorer by doing a 'view source'.

"Farmer" <itsFarmer. freenet.de> wrote in message
news:Xns932EE4D1EB790itsFarmer 63.105.9.61...
 Mark Evans <Mark_member pathlink.com> wrote in
 news:b2v911$1ukq$1 digitaldaemon.com:

 http://research.microsoft.com/vault/

Great link ! Very interesting, especially if your browser ignores <COMMENT> tags like Opera does. <g> I wonder what <COMMENT> tags, there would be in the D spec, if Walter was not clever enough to remove them from the puplic D spec ;-) Farmer

Feb 27 2003