Tuesday, May 01, 2007

Dynamic .Net -- Just what Fox devs ordered

Much discussion has been made about how LINQ will make .Net more Fox like. I think a bigger and more important announcement was made this week. It's called the DLR or Dynamic Language Runtime. DLR will sit on top of the CLR and will initially support four languages, Python, Ruby, JavaScript and VB. Yep, VB will become more of a dynamic language in VBx (the x stands for 10).

In case you're wondering, Fox has been a dynamic language since... well...since forever. Before dynamic languages were called dynamic languages. Now, imagine if you could take the dynamic features of Fox and put them into VB. I'm not not talking about EVAL or macros or loosely typed variables. I'm talking about a command window. Yep. You heard me. A full blown, Fox-like Command Window. Only better.

Don't believe me? Check out this post by Paul Vick. (For you Fox-types, Paul is the VB team's equivalent of Calvin Hsia.) The part of interest is the fourth bullet where Paul says, "Visual Basic should fully support a REPL (Read-Eval-Print Loop). This means taking the support we already have for a REPL in the immediate window in VS and both extending it to the full language and adding the ability to host the REPL outside of Visual Studio.:

So, what is a REPL? Paul links to the Wikipedia topic, which states, "A read-eval-print loop (REPL), also known as an interactive toplevel, is a simple, interactive computer programming environment. The term is most usually used to refer to a Lisp interactive environment, but can be applied to the similar environments for Python, BASIC, Scheme, and other languages as well. In a REPL, the user may enter expressions, which are then evaluated, and the results displayed."

That sure sounds like a Command Window to me. Only better. Yeah, I said that before. Why would it be better? You can't do control structures such as IF/ELSE, FOR, DO WHILE, etc. in the Command Window. Go back and see what Paul wrote, "extending it to the full language". That says loops and control structures will be supported, so it's better than the Fox Command Window.

If you're a Fox dev and have been wanting something like Fox, now is the time to take the plunge into .Net. Learn what there is now. LINQ will be out in the next version (late this year or early next), then VBx, probably sometime in 2009 (my own guess) will complete the picture.

So go on, start looking at .Net. Come on in. The water's fine...and getting better all the time.

Comments:
Loops and control structures are not supported on a line by line bases in the Fox Command Window. However, if you type the lines, arrow down or ctrl+enter to the next line, then highlight all the text, it works.

It's nice to know .NET is going to get something similar
 
Tracy,

You're right, you can type them in, but they don't execute in the Command Window. They are copied to a temporary .prg and run from there. What I'm saying is you'll be able to execute the lines directly in the command window in VB.
 
So what's the difference between "execute the lines directly in the command window in VB." and what Tracy said?

Either way, it effectively executes from the command window, no?
 
The difference is that things execute in the Command Window. Here's an using Fox:
ox = CREATEOBJECT("Collection")
ox.Add(SomeOtherObject1)
ox.Add(SomeOtherObject2)
ox.Add(SomeOtherObject3)
FOR EACH obj in ox
obj.DoSomething
ENDFOR

Suppose inside the FOR EACH loop you wanted to do additional things or experiment some with obj. In Fox, it all gets copied to a temp prg and executed. The obj variable won't exist in the command window. What if in VB you could just run the lines as is in the Command Window. There is a big difference here in how these could work.
 
True, using your example:


ox = CREATEOBJECT("Collection")
ox.Add(SomeOtherObject1)
ox.Add(SomeOtherObject2)
ox.Add(SomeOtherObject3)
FOR EACH obj in ox
obj.DoSomething
ENDFOR

Run the first 4 lines individually, then just run the For Each loop interactively. Or run this first

ox = .null.

then your code. Because it's interactive, one needs to understand how the process happens to get the desired results.
 
>There is a big difference here in how these could work.

Sorry, but there is no difference in the result. :)

I do not care if the needed expression/code is executed directly from the Command Window or copied to temporary PRG and executed from there.

I often use the MODI COMM window as a specialized version of Command Window for specific tests. I can set the breakpoints there and analyze anything I want inside any kind of control structure.

What is important - it's the ability to immediately execute any line/block of code or expression without the need of going through compiltion hoops.

Whether I need to press Enter only in a Command window or Select block - Right Click - Execute -- personally, I don't care.

Nick Neklioudov
 
Nick,

Now that this feature is public, I think I can go ahead and say that I saw it demoed at the MVP Summit. (I alluded to this functionality in a thread on the UT and some correctly guessed it was a Command Window.) There were things shown that were different from the Command Window in Fox, even with the ability you're talking about. At this time, I can't remember specifics. And, that doesn't mean Microsoft won't change functionality.
 
Post a Comment



Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]