.net is a lot like Java, and we can be quite sure that many moons ago the JPython team (as it was then known) had the same problem with Java modules, and probably had a long and heated debate about it so I think we should do it 'the Jython way' as there have never been any problems with it and lots of people use Jython so it must work.

From: Jim Hugunin <[EMAIL PROTECTED]>
Reply-To: Discussion of IronPython <users-ironpython.com@lists.ironpython.com>
To: "Discussion of IronPython" <users-ironpython.com@lists.ironpython.com>
Subject: RE: [IronPython] Making A Windows Form App
Date: Wed, 6 Jul 2005 17:23:55 -0700
MIME-Version: 1.0
Received: from moutng.kundenserver.de ([212.227.126.171]) by mc4-f18.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 6 Jul 2005 17:24:13 -0700 Received: from [66.33.206.23] (helo=frida.dreamhost.com)by mxeu11.kundenserver.de with ESMTP (Nemesis),id 0MKuA8-1DqKBQ3a3n-0005pt for [EMAIL PROTECTED]; Thu, 07 Jul 2005 02:24:04 +0200 Received: from che.dreamhost.com (che.dreamhost.com [66.33.216.23])by frida.dreamhost.com (Postfix) with ESMTPid 880F316D56B; Wed, 6 Jul 2005 17:24:03 -0700 (PDT) Received: from che.dreamhost.com (localhost [127.0.0.1])by che.dreamhost.com (Postfix) with ESMTPid 4D3FB1BA82; Wed, 6 Jul 2005 17:23:59 -0700 (PDT) Received: from mail1.exchange.microsoft.com (mail1.exchange.microsoft.com[131.107.76.156])by che.dreamhost.com (Postfix) with ESMTP id F39541BA63for <users-ironpython.com@lists.ironpython.com>;Wed, 6 Jul 2005 17:23:56 -0700 (PDT) Received: from DF-GWY-01.Exchange.Corp.Microsoft.com ([157.54.54.62]) bymail1.exchange.microsoft.com over TLS secured channel withMicrosoft SMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 17:22:12 -0700 Received: from df-hub-01.exchange.corp.microsoft.com (157.54.8.109) byDF-GWY-01.Exchange.Corp.microsoft.com (157.54.54.62) with MicrosoftSMTP Server id 8.0.324.11; Thu, 7 Jul 2005 00:22:12 +0000 Received: from df-hub-01.exchange.corp.microsoft.com ([157.54.8.109]) bydf-hub-01.exchange.corp.microsoft.com with MicrosoftSMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 17:22:12 -0700 Received: from DF-BANDIT-BHD.Exchange.Microsoft.com ([157.54.54.229]) bydf-hub-01.exchange.corp.microsoft.com over TLS secured channel withMicrosoft SMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 17:22:12 -0700
X-Message-Info: JGTYoYF78jFojgLyvLebIfsbiobYIaFJ60Vutv4BY8A=
Delivered-To: [EMAIL PROTECTED]
Content-Class: urn:content-classes:message
X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0
X-OriginalArrivalTime: 07 Jul 2005 00:22:12.0177 (UTC)FILETIME=[EB6BD410:01C58289] X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [IronPython] Making A Windows Form App
Thread-Index: AcWCZWV8ChLmjDVBQuSUEVbp1jOpZQAARvlAAADzv3MAB2xg0A==
X-BeenThere: users-ironpython.com@lists.ironpython.com
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Discussion of IronPython <users-ironpython.com.lists.ironpython.com> List-Unsubscribe: <http://lists.ironpython.com/listinfo.cgi/users-ironpython.com>,<mailto:[EMAIL PROTECTED]> List-Archive: <http://listserver.dreamhost.com/pipermail/users-ironpython.com>
List-Post: <mailto:users-ironpython.com@lists.ironpython.com>
List-Help: <mailto:[EMAIL PROTECTED]> List-Subscribe: <http://lists.ironpython.com/listinfo.cgi/users-ironpython.com>,<mailto:[EMAIL PROTECTED]>
Errors-To: [EMAIL PROTECTED]
Return-Path: [EMAIL PROTECTED]

We clearly need a better design than the current sys.LoadAssembly* methods. For one thing, we shouldn't really be adding these to the existing sys module but putting new methods like this in a new IronPython module. As you point out, we should also do a better job of making this as invisible to the user as possible.

In IronPython-0.6, a much larger number of assemblies were automatically searched for - including the two shown below. This meant that this particular program could run without any of this nonsense. The problem here was that this just delayed the issue of people learning about this issue and made things even more confusing when they wanted to use an assembly that wasn't in the known list. I decided that at this stage it was better to raise this issue front-and-center so that people would be aware of it and hopefully get quickly familiar with it. The other reason I wanted to make this more explicit was in the hopes that it would spur discussion about better ways of solving the problem.

I'm certain that sys.LoadAssembly* is not what will ship with IronPython-1.0. Here are a few possible options in no particular order.

1. Guess the assembly based on the path, i.e. import System.Drawing will try to load "System.Drawing". This would be great if it was a naming convention that was consistently followed, but alas it is a rule that is so consistently broken I'm doubtful of the benefits.

2. Add a config file to specific a large set of default known assemblies and have the user extend this with their own. This ties scripts and config files together in a deeper way than I'd prefer.

3. Extend import, i.e. import System.Drawing from System.Drawing. Of course, the most obvious ways to do this are a change to the Python language.

4. Search some well-known directories to come up with a list of known assemblies and their types and then load assemblies strictly as needed for imports. This would add many seconds to start-up time unless this information is cached and caches are their own source of trouble. FYI - This is closest to what Jython does.

5. I'm sure there are other good ideas out there...

There's a whole separate question as to whether or not any loading by partial name is too dangerous even as explicit as it is today, see here:

http://blogs.msdn.com/suzcook/archive/2003/05/30/57159.aspx

Thanks - Jim


________________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Keith J. Farmer
Sent: Wednesday, July 06, 2005 1:36 PM
To: Discussion of IronPython
Subject: RE: [IronPython] Making A Windows Form App

Out of curiosity, would it be possible to get IronPython to make a best-guess attempt at automatically loading an appropriate assembly, if it discovers that it doesn't know the namespace?
 
This could alleviate the problems people have with remembering sys.LoadAssemblyByName.

________________________________________
From: [EMAIL PROTECTED] on behalf of Martin Maly
Sent: Wed 7/6/2005 1:13 PM
import sys
sys.LoadAssemblyByName("System.Drawing")
sys.LoadAssemblyByName("System.Windows.Forms")
_______________________________________________
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


_______________________________________________
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to