Bennett Haselton wrote:
> I hope perl evangelists will not take offense at the request 
> for advice on choosing a new language :)

But they might not be the best source of advice, since their experience is,
presumably, primarily with Perl.

> (1) Statement completion.

I wonder whether ActiveState's development environment does that. I don't
know, not having tried it myself, but I gather they've put together an IDE
that's fairly visual; it might do stuff like that. Sorry for not being more
specific.

> (2) Regular expressions.  I know nothing can top perl, but 
> I'd still like  to be able to convert code like
>       $url = 'http://www.yahoo.com/help/';
>       $url =~ /http:\/\/([^\/]*)\//;
>       $hostname = $1;
> as smoothly as possible.

Few other languages (especially compiled ones) support regular expressions
the way Perl does. I believe Python and Tcl have similar regexes, but e.g.
Java and C do not. There are libraries available for C (e.g. Henry Spencer's
regex package, on which Perl's regexes are based), but you'd have to get
them yourself. And, of course, they wouldn't be as tightly integrated into
the language.

(Oh, and I would probably write that something like

    $hostname = $1 if $url =~ m!http://([^/]*)/!;

, to make the assignment to $hostname only if the regex matches, and using
different delimiters so that I don't have leaning toothpicks like \/\/ in
there.)

> (3) Good integration with relational databases -- more in the 
> IDE than in the language itself.

I can imagine that this would be the hardest to find. I can also imagine
that IDEs with this option will cost quite a bit more than IDEs without --
at least, that seems to be the policy with e.g. Delphi.

> What would be really great is a language that has built-in
> support for mapping objects to  database records -- instantiate
> a class using a database record and all the right fields are
> automatically filled in.

That sounds more like something your IDE does for you with little code
generators or application wizards, than something a language needs to
support.

> (4) Throwing and catching exceptions.  I think that code like
> 
>       $something = GetSomething();
>       if ($something == $errorcode)
>       {
>               # handle error
>       }
>       else
>       {
>               $something2 = Transform($something);
>               if ($something2 == $errorcode)
>               {
>                       # handle different kind of error
>               }
>               else
>               {
>                       # do the actual work with $something2 here
>               }
>       }
> 
> is less elegant than
> 
>       try {
>               $something = GetSomething();
>               $something2 = Transform($something);
>               # do the actual work with $something2 here
>       } catch (exception)
>       {
>               # handle various types of errors here
>       }
> 
> As far as I know, perl doesn't support these.

Exception handling in Perl is generally done with (block) eval and die. For
example:

    eval {
        $something = GetSomething();
        $something2 = Transform($something);
        # do the actual work with $something2 here
    }
    if ($@) {
        # handle various types of error here
        # you can tell what error you got by looking at $@
    }

> (5) Catches syntax errors in code that isn't executed.  
> Presumably because perl is an interpreted language, it won't
  ^^^^^^^^^^
> see errors like:
> 
> if (0)
> {
>       this code does not compile;
> }
> 
> unless that portion of code actually gets executed.

Why presume? Perl is an interpreted language. It should take you about a
minute to try it out.

    perl -e "if (0) { this code does not compile; }"
  
    syntax error at -e line 1, near "does not "
    Execution of -e aborted due to compilation errors.

There, that was fast. And remember you have -c, for syntax checking without
running the script. (Of course, if you have string eval, then you can't
syntax check that at compile time.)

(Although, to tell the truth, you were lucky in your choice of "bad code",
since it contained the Perl keyword "not". Otherwise, especially without
"use strict", a sequence of words will compile:

    perl -MO=Deparse -e "this code does compile"

    'code'->this('compile'->does);
    -e syntax OK

So "this code does compile" is parsed as a method call with its return value
passed to another method call. But if you had a real syntax error such as
missing semicolon, that should be found.)

> Any advice?

Asking in a Perl group may not be your best bet. That's about all the
useful, concrete, advice I can give, since I don't know many other IDEs or
languages in detail. Still, perhaps some of this helped.

Cheers,
Philip
-- 
Philip Newton <[EMAIL PROTECTED]>
All opinions are my own, not my employer's.
If you're not part of the solution, you're part of the precipitate.
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to