ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pdk-beta
pdk-beta
Re: [PDK-Beta] VBSPerl-Beta1
by Eric Promislow other posts by this author
Jun 16 2004 10:43AM messages near this date
view in the new Beta List Site
RE: [PDK-Beta] VBSPerl-Beta1 | Re: [PDK-Beta] VBSPerl-Beta1
On Wed, Jun 16, 2004 at 04:01:11PM +0200, Jenda Krynicky wrote:
>  From: Eric Promislow <ericp@[...].com>
>  > You're right about the code we generate on Mid() -- we can
>  > map directly to substr().  And you need to decrement the
>  > index: Perl is 0-based, Basic 1-based (sort of).
>  
>  Silly typo :-)
>   
>  > As for the CreateObject error, the converter assumes that
>  > the input is correct VB.  Objects must be assigned with
>  > a 'set' statement.  So
>  > 
>  > set x = createObject("Scripting.Dictionary")
>  > 
>  > is recognized
>  
>  Ouch. One  of my most common mistakes in VB(Script).
>  
>  
>  I tried now some VB snippets. (I know you say the convertor is only 
>  for VBScript & VBA.)
>  
>  	Dim Foo As Object
>  
>  gets converted to 
>  
>  	my $Foo;
>  
>  which is great.
>  
>  I was surprised by the results of
>  
>  	set x = new Scripting.Dictionary
>  	set x = new Dictionary

That's because the roots of the converter are in VBScript,
not VBA or "standard" VB.  We're extending the translator
to recognize more of VBA as we go.  Currently the only form
that gives you a dictionary is

     set x = createobject("scripting.dictionary")

modulo case, or course.

>  
>  though. I got
>  
>  	$x = $Scripting->Dictionary;
>  	$x = Dictionary->new();
>  
>  If the convertor converted a complete VB project and the "Dictionary" 
>  was a class defined within the project then the second might make 
>  sense, but since this is not the case I think they should be both 
>  treated the same as
>  
>  	set x = CreateObject("Scripting.Dictionary")
>  	set x = CreateObject("Dictionary")

Added as bug http://bugs.activestate.com/show_bug.cgi?id=32082

Error handlers haven't been implemented yet, as the message shows.

Thanks again,

Eric

>  
>  
>  I also noticed the converter doesn't convert 
>  	On Error Goto Xxxx
>  I think it can't even do that in the general case.
>  
>  I think it would be nice if the error message contained the name of 
>  the label and if the label itself was also included in the converted 
>  code:
>  
>  
>  ...
>  	On Error Goto HandleErrors
>  	some code
>  	Exit Sub
>  HandleErrors:
>  	some handler
>  End Sub
>  
>  	=>
>  
>  ...
>  #### Warning: unsupported On Error Goto HandleErrors
>  	some code;
>  	return;
>  HandleErrors:
>  	some handler;
>  }
>  
>  If there are several On Errors in a procedure you may need to know 
>  what part of code is supposed to be handled by what handler.
>  
>  Jenda
>  
>  ===== Jenda@[...].cz === http://Jenda.Krynicky.cz =====
>  When it comes to wine, women and song, wizards are allowed 
>  to get drunk and croon as much as they like.
>  	-- Terry Pratchett in Sourcery
>  
>  _______________________________________________
>  PDK-Beta@[...].com
>  http://listserv.ActiveState.com/mailman/listinfo/pdk-beta
_______________________________________________
PDK-Beta@[...].com
http://listserv.ActiveState.com/mailman/listinfo/pdk-beta

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved