1. Re: Py

Jiri Babor wrote:

> Hi, David ...

In case anyone hasn't guessed, I'm continuing to develop the Py programming
language. But I have a minor dillemma: Robert has decided not to post
Euphoria clones to his site, and Py is a 95%Euphoria clone.

One way around this would be to cripple Py. But that's not really helpful to
me, since I'd like to actually be able to use the language. No one's going
to use a tool that's crippled, and anyone who cares can get around that
restriction anyway.

So I've opted to go with some grammar decisions that make Py unable to run
Euphoria programs without modification. For example, there type or variable
declarations in Py. So where you would write the following in Euphoria:

   constant Pi = 3.1415927
   integer i
   i = 12

you would write in Py:

   Pi = 3.1415927
   i = 12

and the variables would spring into existance by assignment. Unlike Robert's
complaint about BASIC, Py doesn't magically create and initialize variables
behind your back; if you write:

   a = b

and 'b' hasn't been assigned a value yet, Py will complain loudly*. Py also
doesn't have a notion of functions vs. procedures; everything is a function,
and you can choose to ignore the result if you want (and choose not to
return a value). For example, here is a declaration:

   def foo( b )
      b += 12
   end def

and here are two valid calls to it:

   a = foo( 12 )
   foo( 12 )

As a result, it's fairly easy to convert Euphoria programs to Py: you remove
all the types. But it's a bit more difficult to go the other way around.

As I've mentioned before, Py is sort of a testing ground for a lot of ideas
I've been floating. For example, I've recently implemented namespaces.

For those that are curious, I've put up a web page for Py on my site:

   http://www.lanset.com/dcuny/py.htm

Documentation is sparse (at best), and the code is still pre-alpha, but it's
improving daily.

As always, feedback is appreciated.

-- David Cuny

* Well, it's supposed to. But at this point, if you write:

   if 0 then
      b = 12
   end if
   ? b

then Py will have created 'b' and silently initialized it to zero. It's not
difficult to eventually add a check to ensure that it's initialize before
use, though.

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu