IronPython-0.6 is now available!

?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Duncan said:
Whilst what you say is true in general, C# containing generics is available
today (although still in beta). See http://lab.msdn.microsoft.com/vs2005/

Yes, patches implementing that have been floating around (for Rotor) for
many several now, and they are available for mono as well. Yet, I still
have to see an actual release of .NET 2.0, to provide the feature. It
appears that this might ship along with Visual Studio Whidbey (2005 or
later) or Windows Longhorn (2007 or later).

These days, Microsoft follows the principle "publish early, publish
often", giving the impression that a release is imminent. I haven't
read the license, but I doubt it would allow me to ship applications
for .NET 2.0, let alone shipping the .NET 2.0 redistributables.

Regards,
Martin
 
J

John

Oh Boy! You do disagree with almost everything I said. My post was
asking for it. Wasn't it? :). I don't want to start a language war,
especially with languages not even the topic of the group. Not that
that I dislike language wars. They are educational so long as I am not
in them :).

VS2005 free version just came out and I am in puppy love. Hence the
passionate post.

I don't have any bone to pick on Swing, EJB or MVC per se. They just
don't solve MY problems (and I tend to think most people's problems)
as easily as I would expect them to.
It *does* have classpath issues - sometimes even greater than Java's -
but most of the time this is hidden from the developer.

OK! I am unaware of any. Can you point me to some.
Why not? Because the APIs closer match another language you've used?
If so, coincidence.

Not at all! I am not saying C# is special. Just that Java IO is
annoying for day to day tasks. 3 classes to open a file? That is
taking the flexibility factor a bit too far. Would it kill them to
include a few classes for day to day tasks?
Performance should be about the same, since both languages are
compiled to native code on startup.

I have no bench marks at hand to back things up. C# apps ALWAYS felt
faster than Java apps in my experience.
Oh, Microsoft's fabled "xcopy deployment"? How is copying a jar file
harder than compying an EXE plus required DLLs?

Yes! Why do I have to list every jar file I use for the application in
the classpath? Why can't I just drop them in the same folder with the
app and expect the JVM to find them. Isn't that intuitive? Practically
every VM language I know does that. Current folder had to be listed in
explicitly in the current path. Is that intuitive? Every other
language behaves the other way.
JavaFaces seems to match the functionality of ASP.Net's CodeBehind
logic, except you're not restricted to an event model; you configure
events yourself in XML files. IDE support for it is coming.

I would not use ASP.NET without IDE support. ASP.NET and JFaces are
built for IDE technologies. So I consider JFaces immature at present.

I tried JFaces in Sun's IDE. In general I find servlet container
based approach painful because of the class loaders. I know that many
people use them happily. I am not one of them.
Which Java IDEs have you tried? And which C# ones?

WSAD, Netbeans and Eclipse.
Visual Studio.

You are a Java developer and probably have used these IDE's over an
extended period of time to no longer see the complexities within.

To test intuitiveness, take a newbie, give him J# in VS and Java in
WSAD.

To quote an example, we teach Java here. I was discouraged to
introduce Eclipse (which is much simpler than the other Java IDEs and
I loved it immediately after coming across it for the first time) to
the students because it overwhelmed them. On the other hand, I would
not even want to introduce C# without Visual Studio.
The only language designed for .Net is and will always be C#. The
other languages are *wrestled* into the CLS strait-jacket, and for
some - like C++ - it does not fit well.

They seemed to compile Quake 2 fine.
 
I

Ivan Voras

Elbert said:
C# IS a good language and .NET is a very good environment. Recently I
had to write a little program. "one of a kind", "throw away". It took
2.5 hours to finish the proto. Worked fine, but would requere night to
run. Had to rewrite in... C++ or C#. Having the proto in Python, C#
program was written almost as fast as Python's one. The run finishhed
in 1 hour.

Important - Python realities (not exotic) map on C# perfectly.

My experience exactly - this is what I was fishing for. While I wouldn't
say 'perfectly', it is good, and certainly 'good enough'.
 
D

Derek Thomson

Err... What do you mean? Twisted has, at least, 3 different ways of doing
RPC: Perspective Broker, SOAP and XML-RPC.

Yeah, I know - I said "easily" :) It's basically the client side API I
have a problem with:
====
from twisted.spread import pb
from twisted.internet import reactor
from twisted.python import util

factory = pb.PBClientFactory()
reactor.connectTCP("localhost", 8789, factory)
d = factory.getRootObject()
d.addCallback(lambda object: object.callRemote("echo", "hello network"))
d.addCallback(util.println)
d.addCallback(lambda _: reactor.stop())
reactor.run()
====

So, why can't it just be basically:

object.echo("hello network")

.... as it is in CORBA and (other) XML-RPC and SOAP toolkits I've used.

I also have a problem with the insistence on the use of asynchronous
callbacks. In order to use the result of the RPC call later in the
main flow of my code, I have to somehow block in the main thread for
the the result to be returned from the server via the callback - this
is something that can be done for me, and is handled simply and
transparently in other RPC toolkits/mechanisms I've used.

I'll try to characterize this with a simple example. How would I write
something like this, where I have three distributed objects:

i = an_object.get_value()
j = another_object.get_value()
k = yet_another_object.combine(i, j)

.... and now finally use "k" in my code?

I could be missing something, but isn't that going to turn into a mess
of dependant callbacks in Twisted? Aren't I going to have to write a
whole lot of code that blocks until the results come back? I don't
mean this as a challenge or a judgement anything, I'd honestly like to
know - I would like to look further into Twisted but was pretty much
put off by this issue right from the start.

Regards,
Derek.
 
S

Sam Holden

Yeah, I know - I said "easily" :) It's basically the client side API I
have a problem with:


So, why can't it just be basically:

object.echo("hello network")

... as it is in CORBA and (other) XML-RPC and SOAP toolkits I've used.

I also have a problem with the insistence on the use of asynchronous
callbacks. In order to use the result of the RPC call later in the
main flow of my code, I have to somehow block in the main thread for
the the result to be returned from the server via the callback - this
is something that can be done for me, and is handled simply and
transparently in other RPC toolkits/mechanisms I've used.

Twisted is asynchronous so obviously it makes such a demand. You don't
have a "main thread" to block anyway - twisted calls your code for
you...

Obviously if you don't like that style of programming you won't like
twisted.
I'll try to characterize this with a simple example. How would I write
something like this, where I have three distributed objects:

i = an_object.get_value()
j = another_object.get_value()
k = yet_another_object.combine(i, j)

So that doesn't call another_object.get_value() until an_object.get_value()
completes?

That's be nasty for high latency (due to network delays or lots of server
computation or whatever) RPC.
... and now finally use "k" in my code?

I could be missing something, but isn't that going to turn into a mess
of dependant callbacks in Twisted? Aren't I going to have to write a
whole lot of code that blocks until the results come back? I don't
mean this as a challenge or a judgement anything, I'd honestly like to
know - I would like to look further into Twisted but was pretty much
put off by this issue right from the start.

I must admit I haven't been using twisted for long, and I haven't used RPC
at all, but my first crack at it would be (based on the original example):

The server:
===
from twisted.spread import pb
from twisted.internet import reactor

class Echoer(pb.Root):
def remote_echo(self, st):
print 'echoing:', st
return st

def remote_reverse(self, st):
print 'reversing:', st
l = list(st)
l.reverse()
return ''.join(l)

def remote_concat(self, a, b):
print 'concating:', a, 'and', b
return a+b

if __name__ == '__main__':
reactor.listenTCP(8789, pb.PBServerFactory(Echoer()))
reactor.run()
===

The client:
===
from twisted.spread import pb
from twisted.internet import reactor
from twisted.python import util
from twisted.internet import defer

def do_stuff(obj):
d1 = obj.callRemote("echo", "abc")
d2 = obj.callRemote("reverse", "abc")
dl = defer.DeferredList([d1, d2])
dl.addCallback(lambda r: obj.callRemote("concat", r[0][1], r[1][1]))
dl.addCallback(util.println)
dl.addCallback(lambda _: reactor.stop())

factory = pb.PBClientFactory()
reactor.connectTCP("localhost", 8789, factory)
d = factory.getRootObject()
d.addCallback(do_stuff)
reactor.run()
===

That's missing error checking and all that stuff, but it seems simple
enough.

Replace util.println with a callback that does the 'and now finally use
"k" in my code' stuff.

I also only used the one remote object, but that's easy to change.
 
T

Tor Iver Wilhelmsen

OK! I am unaware of any. Can you point me to some.

Well, the one I "crashed" into was when I (by mistake) had compiled
Microsoft's free ASP.Net container (Cassini) using version 1.0 of the
framework, while my ASP.Net application was compiled using version 1.1
of the framework. The result was that the container complained that it
could not find the superclass for my page, since the 1.0 version of
System.Web.HttpApplication is *not* the 1.1 version of
System.Web.HttpApplication. It doid not even try to use it.

In Java, I *might* later have received a runtime exception about a
missing method, if I actually used a method that was too "new".

(The solution to the Cassini problem was to manually write an
application .config XML file that told it to use the 1.1 framework.
This config file is also where you define any dependencies to
particular versions of libraries; by default an application will use
the newest available.)
Yes! Why do I have to list every jar file I use for the application in
the classpath? Why can't I just drop them in the same folder with the
app and expect the JVM to find them.

You can, if the jars are included in your "main jar"'s manifest's
Class-Path value, e.g.

Main-Class: some.Application
Class-Path: library.jar stuff.jar

Setting this up is, as in the case of .Net, a task for your IDE.
Isn't that intuitive? Practically every VM language I know does
that. Current folder had to be listed in explicitly in the current
path.

For safety reasons: These are Unix people. You simply don't trust the
current directory.
Is that intuitive? Every other language behaves the other way.

Er, "languages" don't behave in that way, executables do. Executables
look in your path environment variable, which the user need to keep up
to date; the Win2k family has moved the setting of that to a
relatively obscure location in the system properties dialog - not very
friendly.

..Net applications look in the "assembly cache", which also needs to be
kept "up to date". You can override dependencies using the "user
friendly" syntax described in

http://msdn.microsoft.com/library/d...de/html/cpconTargetingNETFrameworkVersion.asp
You are a Java developer and probably have used these IDE's over an
extended period of time to no longer see the complexities within.

I've used JBuilder and JDeveloper almost exclusively; I never could
get my head around the "project-less" directory-focused and slow
NetBeans.
To quote an example, we teach Java here. I was discouraged to
introduce Eclipse (which is much simpler than the other Java IDEs and
I loved it immediately after coming across it for the first time) to
the students because it overwhelmed them. On the other hand, I would
not even want to introduce C# without Visual Studio.

Because it hides the .Net complexities from the developer. Is that a
good thing?
They seemed to compile Quake 2 fine.

How much of it ended up as unmanaged code? An application that runs
outside of the managed container is not a .Net application.
 
T

Tor Iver Wilhelmsen

Michael Ekstrand said:
Why do you say this?

Because many languages are made without it (Java, C#, Smalltalk), a
major language having it (C++) implements it in a way that makes a
developer need to be super-careful when using it, and any problem that
can be solved using MI can be solved without using it.
A while ago, I was working with an object model in which there was
no effective way to represent the necessary data without multiple
inheritance (which made things really interesting when I was
considering porting it to Java).

Java has indirect support for MI using nested classes.
 
L

Lawrence Oluyede

In data 31 Jul 2004 11:29:10 +0200, Tor Iver Wilhelmsen ha scritto:
Java has indirect support for MI using nested classes.

Nesting classes is an unneeded complication, and AFAIK is not pure MI. I
think that the only "bare MI support" that Java does have are MI of
interfaces...

bye!
 
T

Tor Iver Wilhelmsen

Lawrence Oluyede said:
Nesting classes is an unneeded complication, and AFAIK is not pure MI. I
think that the only "bare MI support" that Java does have are MI of
interfaces...

There is nothing pure about MI. But that's a religious dicussion.
Python handles it better than C++ at least.
 
D

Dan Bishop

Tor Iver Wilhelmsen said:
There is nothing pure about MI. But that's a religious dicussion.
Python handles it better than C++ at least.

And ironically, there's less of a need for MI (and inheritance in
general) in Python, because it's dynamically typed.

I don't think I've ever used MI in Python.
 
E

Edward Diener

Tor said:
There is nothing pure about MI. But that's a religious dicussion.
Python handles it better than C++ at least.

Why do you say that ? In other words, what in Python's implementation of MI
is superior to C++'s implementation of MI ?
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Edward said:
Why do you say that ? In other words, what in Python's implementation of MI
is superior to C++'s implementation of MI ?

In Python, MI is easier to understand than in C++. The state definition
for an object is simpler, as there is no need for virtual-vs-non-virtual
inheritance. Also, there are no casting issues in Python that cause
common errors in C++ (because in MI, casting can change the
representation of the address of an object).

Regards,
Martin
 
L

Lawrence Oluyede

In data 31 Jul 2004 17:30:23 -0700, Dan Bishop ha scritto:
And ironically, there's less of a need for MI (and inheritance in
general) in Python, because it's dynamically typed.

I don't think I've ever used MI in Python.

Yeah, me too, I prefer the mixin approach, anyway, if you want to take a
look at a framework (with a wonderful API IMHO) that massively uses MI
watch Soya3D sources: http://home.gna.org/oomadness/en/soya/
 
J

John

OK! I am unaware of any. Can you point me to some.
Well, the one I "crashed" into was when I (by mistake) had compiled
Microsoft's free ASP.Net container (Cassini) using version 1.0 of the
framework, while my ASP.Net application was compiled using version 1.1
of the framework. The result was that the container complained that it
could not find the superclass for my page, since the 1.0 version of
System.Web.HttpApplication is *not* the 1.1 version of
System.Web.HttpApplication. It doid not even try to use it.

In Java, I *might* later have received a runtime exception about a
missing method, if I actually used a method that was too "new".

(The solution to the Cassini problem was to manually write an
application .config XML file that told it to use the 1.1 framework.
This config file is also where you define any dependencies to
particular versions of libraries; by default an application will use
the newest available.)

That is more of a side effect of versioning features. Interesting case
anyway. I will keep that in mind.
You can, if the jars are included in your "main jar"'s manifest's
Class-Path value, e.g.

Main-Class: some.Application
Class-Path: library.jar stuff.jar

Setting this up is, as in the case of .Net, a task for your IDE.

I had some facts wrong about .NET for that bit. I looked up after your
post and I know better now.
I've used JBuilder and JDeveloper almost exclusively; I never could
get my head around the "project-less" directory-focused and slow
NetBeans.

OK! JBuilder does not look intimidating. I never got excited about the
JDeveloper's layout of tools.
Because it hides the .Net complexities from the developer. Is that a
good thing?

Hiding complexities from newbies and intermediate users is not a bad
idea. The project files are XML anyway. MS is mostly good at catering
to the needs of that market. Most Java tools don't seem to do that.
The impression I often get is Java is developed primarily for the
enterprise.
How much of it ended up as unmanaged code? An application that runs
outside of the managed container is not a .Net application.

I wasn't talking in just performance terms. I meant how the language
fit. But that's a good point. That would be interesting to know. Even
then, the prospect of being able to seemlessly add unmanaged code for
performance bottlenecks without the additional cognitive overhead of
integration API is nice.
 
V

Valentino Volonghi aka Dialtone

So, why can't it just be basically:

object.echo("hello network")

... as it is in CORBA and (other) XML-RPC and SOAP toolkits I've used.

I don't think that calling:

object.echo("hello network")
instead of
object.callRemote('echo', 'hello network')

is making any difference at all... Actually the CORBA author is evalutaing
twisted for his next needs (IIRC). Add this to the fact that doing
callRemote() you are not moving any objects around, Perspective Broker
let's you copy objects from the remote side to the client side and then
you would be able to call

object.echo('hello network')

for instance.
I also have a problem with the insistence on the use of asynchronous
callbacks. In order to use the result of the RPC call later in the
main flow of my code, I have to somehow block in the main thread for
the the result to be returned from the server via the callback - this
is something that can be done for me, and is handled simply and
transparently in other RPC toolkits/mechanisms I've used.

Clearly you do not know deferreds. Twisted won't wait for your response
blocking the whole thread. It will just send the request and when the
response comes back it will call your code for you.
I'll try to characterize this with a simple example. How would I write
something like this, where I have three distributed objects:

i = an_object.get_value()
j = another_object.get_value()
k = yet_another_object.combine(i, j)

... and now finally use "k" in my code?

You will use it in a callback.

Obviously if you don't like callbacks you won't like twisted, but this
doesn't make RPC with twisted primitive. I would say that you simply don't
like the way you write code with twisted.
I could be missing something, but isn't that going to turn into a mess
of dependant callbacks in Twisted? Aren't I going to have to write a
whole lot of code that blocks until the results come back? I don't
mean this as a challenge or a judgement anything, I'd honestly like to
know - I would like to look further into Twisted but was pretty much
put off by this issue right from the start.

Code won't block. You should read how deferreds work (note: they are not
making your blocking code into non-blocking code, but they will be waiting
in the background for an answer to a request, without blocking everything).

BTW Twisted provides 2 different ways of making you blocking code
non-blocking.

You can use deferToThread, if you have a very long atomic operation (like
querying a remote database), or you can divide your very-big-function into
many different steps and call each other with
reactor.callLater(0, nextStep)
Which makes the call happen the next cicle in the reactor (so to allow the
reactor to handle some requests in the meantime).

Usually for third party modules with blocking logic the most used choice
is deferToThread. But I suggest you reading the documentation from
www.twistedmatrix.com which is a lot more helpful.

HTH
 
E

Ely Stob

Ivan Voras said:
My experience exactly - this is what I was fishing for. While I
wouldn't say 'perfectly', it is good, and certainly 'good enough'.

Interesting comment.

Anybody have recommendations (and warnings-off...) for books on C#, .NET,
and associated gubbins? (ASP.NET, ADO.NET, Windows Forms, ...)

I'm guessing that I'll need a good half-tonne of dead tree if I'm to get a
grasp of it <0.5 wink>. Figuring out *which* half-tonne might be even
more time-consuming than reading that dry mass, though...

Some books that caught my own eye - all comments much appreciated:


C# and .NET
===========

Jesse Liberty; Programming C#

Andrew Troelsen; C# and the .Net Platform

Anders Hejlsberg, Scott Wiltamuth, Peter Golde; The C# Programming Language

Box, Sells; Essential .NET

Stephen Teilhet, Jay Hilyar; C# Cookbook; (O'Reilly)

Peter Drayton, et al; C# in a Nutshell; (O'Reilly)

J Richter; Applied Microsoft .NET Framework Programming


Windows Forms
=============

Chris Sells; Windows Forms Programming in C#

Matthew MacDonald; User Interfaces with C SHARP: Windows Forms and Custom Controls


ASP.NET
=======

Jesse Liberty, Dan Hurwitz; Programming ASP.NET

Fritz Onion; Essential ASP.NET with Examples in C#

N. Kothari; Developing ASP.NET Server Controls and Components


ADO.NET
=======

D. Sceppa; Microsoft ADO .NET (Core Reference)


Misc
====

R. Jeffries; Extreme Programming Adventures in C#


I see Petzold is soldiering on, too :-/


ely
 
E

Ely Stob

Martin v. Löwis said:
I have worked a lot with C# and .NET lately, and found two things:
- the VM is very well designed. It does not really work for languages
other than C#, though (and, yes: I believe that it does not work
well for Python either, despite IronPython's existance (*))
^^^
Where is the referent of your asterisk?

I'm very much interested in why you insist that the CLR does not work
well for Python, in the face of an apparently solid existence proof,
in the form of IronPython, that that simply isn't the case.

I know you have a sound understanding of Python, and sometimes
understanding beats apparent empirical evidence...


Ely
 
J

John J. Lee

Yeah, very pre-alpha from the few tests I did, but I'm very excited
about this, especially as it seems the Parrot guys have given up on
Python :-(
[...]

Hey, I just realised how many Python implementations there are now:

Useful:

CPython
Jython
Stackless
psyco

On their way:

IronPython
PyPy
parrot?
Starkiller?

Not such a short list.

Maybe standardisation committees are just round the corner. Oh joy.


and a few close descendants, of course:

Pyrex
Prothon
Boo
Vyper (defunct)


John
 
T

Terry Reedy

Ely Stob said:
I'm very much interested in why you insist that the CLR does not work
well for Python, in the face of an apparently solid existence proof,
in the form of IronPython, that that simply isn't the case.

Does IronPython currently run the whole test suite as well as CPython on
Windows? (Has anyone even tried?) I presume from the 0.6 designation that
it might not, in which case the existence proof would not yet be solid.

Has anyone independently verified J.H's timing claims?

Terry J. Reedy
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Ely said:
Where is the referent of your asterisk?

Oops. It slipped under the table. Here it is:

(*) A lot of languages which appear to be supported on .NET really
aren't, atleast not in their original form. Instead, a .NET version
of the language gets defined, which deviates in its semantics and
feature set from the original syntax. I would expect the same to be
the case for IronPython.
I'm very much interested in why you insist that the CLR does not work
well for Python, in the face of an apparently solid existence proof,
in the form of IronPython, that that simply isn't the case.

I know you have a sound understanding of Python, and sometimes
understanding beats apparent empirical evidence...

So far, I believe it is hard to tell, because IronPython is still
not complete. However, I firmly believe that you cannot make a
full Python implementation (i.e. with the language reference and
the portable standard libraries) on .NET which is also CLS
compliant. Maybe IronPython does not aim at being CLS compliant,
which might improve the chances that it is Python.

To see what I mean in other languages: Managed C++ is a language
different from C++, for example, the delete operator has a different
meaning in managed C++ than it has in standard C++. Likewise, J#
is a language different from Java. Essentially, I believe that
all these .NET languages are just different ways to write C#.

Regards,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top