1. Re: Py
- Posted by Jiri Babor <J.Babor at GNS.CRI.NZ> Oct 19, 2000
- 443 views
Hi, David, >> I just could not resist the temptation, I had >> a *quick* look at your Py. Very, very nice indeed. >> So nice in fact, it's discouraging as far as my >> own project is concerned... > > so steal from what i've coded, and do your own version. the core of > euphoria is already there, so it's not that hard to add your own > features. > > if you're really that discouraged, just harass me into adding the > features you want, and i'll try to get them in. Now you sound just like Microsoft. I promise you are not getting rid of your competition that easily. ;) >> Just one thing I do not really like, you clearly >> said 'return must always return a value'. > the sad reason for this is because my grammar is stupid. the first > pass of the language limited statements to a single line. this > allowed the parser to understand the difference between: > > return '\n' > > and > > return Expr '\n' > > the current incarnation treats newlines as whitespace. as a result, > if you wrote this: > > return > a = 12 > > the parser doesn't know if you mean that, or: > > return a = 12 > > rather than write some complex hack into the parser, i just set it > so you always pass a value back with return. > > here's the key: unlike euphoria (but like c), py allows you to > ignore the return value. <snip> Well, I am not sure what's a more complex hack. I suspect the real culprit is the Euphoria's return statement. It comes from the same stable as the infamous '?' print shorthand I mentioned earlier. It also has what I would call a 'dangling' argument. If you change return into return(), the problems disappear. > did this answer the question? Which one? (- Just kidding.) Last night I did not play tennis, I elected to give my knee a chance to recover, and it already feels better. I did a bit of surfing and a bit of thinking, no coding. I was wondering what would be the best use of colons (:). (This kind of stupid, greedy thinking stems from decades spent designing bridge systems, using minimal vocabulary within a severely restricted space.) You suggested vertical slicing. That would be cute, but I suspect quite unnecessary. I decided I'll use them to sugar-coat my favorite data type: lists, associative arrays. Imagine (using my list.e) w = width:box x:box = 100 instead of w = fetch(box, "width") box = store(box, "x", 100) and for nested lists: a = age:jiri:euphorians country:jiri:euphorians = "Aotearoa" instead of a = Fetch(euphorians, {"jiri", "age"}) -- the answer is 59 euphorians = Store(euphorians, {"jiri", "country"}, "Aotearoa") What do you think? Btw, I never heard you say 'associative lists'. Why? A lot of people, including me, seem to think, they could solve almost all world's problems (Robert's line :)). jiri