1. Re: Stripped Perl?

>Date:         Wed, 24 Jun 1998 05:12:12 -0400
>Reply-To:     Euphoria Programming for MS-DOS
<EUPHORIA at LISTSERV.MUOHIO.EDU>
>From:         Falkon <Falkn13 at IBM.NET>
>Subject:      Re: Stripped Perl?
>To:           EUPHORIA at LISTSERV.MUOHIO.EDU
>
>From:    Andy Kurnia
>Re: EUPHORIA Digest - 21 Jun 1998 to 22 Jun 1998 (#1998-36)
>
>>now let's talk about the clumsiness of "else" and short-circuited
"or":
>
>[clumsy code with unparenthesized compound boolean expressions snipped]
>
>>Tell me how you would code the above if the "elsif" above with the
>>current Euphoria version. Since I noted above x can be changed, you
may
>>not use
>>    elsif y[1] != GET_SUCCESS or not find(y[2], {2, 4, 6, 9, 11}) then
>>which should work since get() always returns a 2-element sequence.
>
>include input.e  --(custom include with prompt input and
value-checking)
>integer y
>constant x = {31,28,31,30,31,30,31,31,30,31,30,31}
>while 1 do
>   y = InputPosInt( "Enter a month with less than 31 days (0 to quit):
" )
>   if y < length( x ) then
>      if x[y] < 31 then
>         puts( 1, "Thank You.\n" )
>         process( y )
>      else
>         puts( 1, "That month has 31 days.\n" )
>      end if
>   else
>      puts( 1, "There aren't that many months in the year!\n" )
>   end if
>end while
>
>    That's how I'd do it.  Incidentally, InputPosInt() is a routine I
wrote
>awhile back that doesn't use get or value.  It displays the prompt,
>reads input with gets(), and converts it to an integer with and_bits().
>If you enter an invalid value, it puts "Please enter a positive
integer."
>and loops until it either gets a 0 (and aborts) or a positive integer.
>
>>Perl can do C-like commands like
>>    $i += 3;
>>    $j++;
>
>   Euphoria doesn't require us to look up every cryptic command in a
set
>of a dozen 900-page manuals in order to decipher illegible source code.
>It's a high-level language.  It can do i = i+3 and j = j+1, which
>have the same effect and are more readable.
>
>>Perl allows command output capturing, as in
>>    $diffout = `diff -w oldfile newfile 2>&1`;
>>        # 2>&1 in unix means stderr should be redirected to stdout
>>    if ($? >> 8) { # if errorlevel is not zero
>>        print "Changes:\n";
>>        print $diffout;
>>    }
>>    else {
>>        print "No changes\n";
>>    }
>>etc. Euphoria, stuck with the 20k tracer installed in it, can't do
that...
>
>Not quite sure what that does, but I believe you mean something like...
>
>   system( "diff -w oldfile newfile >diffout.txt", 2 )
>   diffout = ReadFile( "diffout.txt" )
>   if diffout[1] != "No changes" then
>      --or whatever the output of diff is in that case
>      puts ( 1, "Changes:\n" )
>      puts ( 1, diffout )
>   else
>      puts ( 1, "No changes." )
>   end if
>
>   Of course, I'm assuming that diff is some sort of program and that
>you've written that ReadFile() routine.  Incidentally, the ability to
>use the errorvalue of a program/os command is one thing currently
>missing from Euphoria.  (Next version, right Rob?)  But it's just as
>easy to write a program that gives some sort of text output as it is
>to write one that returns an errorlevel.
>
>   Deciphering difficulties...
>
>   "if ($? >> 8) { # if errorlevel is not zero"    --perl
>
>   $? = incomprehensible_symbol (errorlevel?),
>   >> = appendto pipe in DOS, some kind of stream direction in C++,
>    8 = 8
>
>  (incomprehensible_symbol appended to 8) : (errorlevel != 0)
>  append(8, incomprehensible_symbol) : (errorlevel != 0)
>
>     estimate of perl translation         comment translation
>  "if append( 8, errorlevel ) then" : "if (errorlevel != 0) then"
>
>  The Euphoria version looks just like your comment, right?  Needed
>little or no translation from human thought.  Code that looks the way
>we think is generally better than code that translates into meaningless
>stuff.  If I knew perl, of course, maybe I could have gotten a proper
>translation.  But on the other hand, any programmer can understand the
>Euphoria version of that basic statement, even if they've never heard
of
>Euphoria.
>
>
>>Perl allows you to have a Perl code embedded as string, and execute
it,
>>and tell you if it worked or if it has an error.
>
>   That would be nice.
>
>>Perl can check if a variable or a routine exists, is defined, or ...
well,
>>Euphoria has routine_id but no variable_id.
>
>   Variable_id(), a pointer to the variable, wouldn't be good, or
necessary.
>But a boolean function if_defined() that works for any user-defined
symbol
>(constants, variables, and routine names) would be useful.
>
>>Perl can also be compiled
>>for win32 etc if you get the source,
>
>   And have the right compiler (c?, c++?, ANSI or other?, what
version?,
>what compile switches?), and know how to use it, and edit the source to
>run on your machine and change the headers and includes and, and...
>Right?  I've downloaded a few c programs that only came as source, and
it
>wasn't long before I just deleted 'em, rather than try to figure out
how
>to compile them on my compiler so that they'd work.  Euphoria saves you
all
>that hassle and gives you the binaries, you don't even need to know c
to
>use Euphoria.
>   I'd guess that there's a pre-compiled version of Perl available
somewhere
>too, though.
>
>>There is no debugging facility at all in Perl
>
>   Hmm...all that cryptic code and no way to debug it?  Pbbt.
>-100 points.
>
>   I'm not slamming Perl, I'm sure it's pretty powerful and has some
>use.  But Euphoria is not a stripped-down perl.  It's a distinctly
>different language with it's own strengths and weaknesses that
>is at least the equal of Perl, IMO.
>

One thing about perl; I wanted to do a job for a fav sysop of mine, and
decided to try and lern perl. Thought it was easy, no prob. (Just like I
thought about C <boom>) Guess what? IT WAS HELL! I couldn't get if I
could have multiple STDIN's and OUT's, how to input data, just stuff
normally needed. After this one month period (of having the book) I
didn't get crap. So I threw away the book. (Actually, I took it back to
the library. Basically the same :)

Euphoria; learned it in +/- two weeks, still haven't mastered it, but at
least I get it and can code some stuff for myself... (BTW, two weeks,
sometime after the run-in with Perl) And, I thought about Euphoria the
same way with Perl and C, and I was actually right for once...

Probably you all have the same (or slightly different) stories, but I
had to voice my opinion on Perl.

C, on the other hand... (I'll save it for another thread...)

From the mind of a 13 year old...

"LEVIATHAN"

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu