Re: EUPHORIA Digest - 21 Jun 1998 to 22 Jun 1998 (#1998-36)

new topic     » topic index » view thread      » older message » newer message

>Yes, why not have a quake function, that can be given a set of sprites
>and levels and have it built-in ??
>Then we can all *program* quake clones... "hey, mom, look, _I_ made
>this smile)"

I'm all for it! ;) (Actually, you'd also need to include the functions
jedi_knight(), simcity(), mario(), wingcommander() and asteroids()... :)

>A program language is *not* effictively combining other people's code,
>if you want that you should use Visual Basic.

That's what include files are for. Go find one... What, they make the
program more than 300 statements!?! (BTW, I'm not registered either) Dish
out ~$35 U.S. and stop complaining.. ;)

>In any sophisiticated programming language you will get the building
>blocks, and make an applications.
>And the more trivial the building blocks the more powerfull the
>programming language.

Just look at machine language, that's the most trivial building blocks,
and the fastest. But I don't think it's too understandable. Euphoria is a
good (best) comprimise between speed and usability/simplicity.

>A file length function is not a trivial building block! Don't you
>agree ?

That's what include files are. David, toss that filelength in with the
goodies.e.... :) (As well as the seek() method, for sending the file
handle of an opened file. dir()'s results aren't updated until the file
is closed and the FAT is updated. seek() can find the length of a file
that's been added to and hasn't been closed.)

>><advertisement>
>>it has built-in hashes, not to mention the always-necessary standard
>
>See the comment above about trivial and non-trivial building blocks.
>Plus, there is no such thing as an universal hash function anyway.
>At the RDS page you will find hash-code though. You can set your own
>hash-functions.
>Don't come with expensive again, euphoria custom coded hash-functions
>are still at least 5 to 10 times faster than Perl's built-in.

But you have to download it! Perl doesn't need to be downloaded, if you
have Unix! ;) (Ok, I'm being sarcastic.) BTW, the hash routines can be
found in Euphoria 2.0 under %EUDIR%\demos\hash.ex

>>file-manipulation commands exist as built-in commands (unlink, mkdir,
>>etc).
>>
>>Perl can read entire file at once, simply by
>>    undef $/;
>>    $x = <FILE>;
>>while $x = <FILE> is normally translated to "x = gets(x)", and $/ is
>>'\n'.
>>That means we can define our own end-of-line string.

What's undef? What's the $ needed in front of the variable? What type is
x? Where is it defined? What is x if the file doesn't exist?
With Euphoria, you don't have those questions

>function perl_gets (integer fh, integer eol)
>sequence ret
>    ret = {getc(fh)}
>    while ret[length(ret)] != -1 and ret[length(ret)] != eol do
>        ret = append(ret, getc(fh)
>    end while
>    if ret[length(ret)] = -1 then
>        return ret[1..length(ret)-1]
>    else
>        return ret
>    end if
>end function

This might be more appropriate:

-- Untested
function read_file(sequence filename, integer delimiter)
   -- Reads file until the EOF marker is met, or the delimiter is
   -- found, and doesn't include it in the return.
   integer fn, char
   sequence ret

   fn = open(filename, "rt") -- Change to "rb" for binary files
   if fn = -1 then
      return -1
   end if
   ret = ""
   while 1 do
      char = getc(fn)
      if char = -1 or char = delimiter then
         exit
      end if
      ret = ret & char -- Faster in my experience than ret=append(ret,
char),
                       -- but don't know what would be faster in this
example.
      -- put char = delimiter here if you want to include the
      -- delimiter with the rest, like gets() does. Leave it as is to
      -- leave it out.
   end while
   return ret
end function

>>Perl can do C-like commands like
>>    $i += 3;
>>    $j++;
>
>Another.. I have to type so much.. get a typing cursus..or get Perl,
>C, ASM (very short commands blink

Machine language! :)

>Yes, Euphoria code, when programmed right is almost always shorter,
>safer, and faster executed compared to Perl. Thats what the 'powerful'
stands
>for in 'powerful 32-bit programming language' blink

But you have to download it! It takes a whole 5-10 minutes! ;)

>Plus, the 300 statement limit is not a feature. It makes people with
>less time pay for quicker program development and more easy. Robert has
to
>live and be able to buy new C++ compilers as well smile

Plus, there are only three limitations with not registering:

300 statement limit. (The only 'real' limitation, the rest are just
features, and not normally required.)

Encrypting your code. (It may be required in some circumstances, but I
haven't come across any....)

Voting for the Micro-Economy. (How many times has that been a requirement
for a programming language?)

>>Perl allows to modify file attributes and date/time with built-in
>>commands.

Yes, we all want our programs to mess around with the date and time on
our computers... File attributes are more important, but how many times
is that needed?

>>Perl can open as many files as your system allows. Euphoria limits
>>you to only 12.
>
>You don't know that, ever tried setting files = 1000000000 and opening
>half of the files.
>But true, the 12 is way to little for serieus applications.

But how many people have complained about it? It wasn't until a bug was
encountered with read_bitmap(). Even when Rob mentioned it before, once,
I don't remember anybody saying anything about it....

Besides, he is going to raise it, so no need in complaining about
something that's about to change.....

>>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. Codes are run in
the
>>current context, has access to the current variables, and can even
define
>>new subroutines. Euphoria has no self-embedding capability. Example:
>>    $x = 3;
>>    $y = "$x++;"
>>    eval $y; # not sure about the correct syntax though
>>    print $x; # displays 4

>Would be trivial to have this built-in, although it can create very
>strange problems.
>I can make an Euphoria executor for scripts though as a routine.
>(running at less speed than normal thus!)

Actually, why even bother? WHY would you even worry about such a thing?
Besides, Euphoria has a similar feature:

Euphoria allows you to have Euphoria code in the program, and execute it,
and tell you if it worked (it doesn't say anything), or if it has an
error (it crashes and tells you.) No extra code, no unneccary double
quotes, no "eval" statement.

>>Finally, Perl is free (no download time) because it is included as a
>>standard programming language in UNIX systems. Perl can also be
>>compiled for win32 etc if you get the source, which is *available*.
>>Euphoria limits you to 300 lines and never gives a public domain source
>>where I can change that 300 ;->

>Why doesn't Euphoria have '?', because we already have if- which is
>more readable and better to understand.

Actually, Euphoria DOES have ?, but not ?:. :)

? variable_name

But the ?: is VERY, VERY hard to read, at least to me. I just can't
understand the theory behind it. I don't really care, either... if..then
you can tell what is happening just by looking at it. That is what
Euphoria is all about.



_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu