Re: Eu 4.2.0 Beta?

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

Features I like about C++:

  • The ability to set constants in routines rather than only variables.
  • exceptions
  • full classes
  • operator overloading (need classes for this)

From operator overloading, comes the ability to create huge integers for cryptography. I don't know if anyone around here really has the inclination and ability to introduce these features to Euphoria.

Some things I would like to see:

  • delete should be something that not only calls the destructor but takes the passed variable out of scope at the point in the routine it is called.
sequence s 
s = regex:new("[a-z]+") 
puts(1, s) -- I want it to say: 's is no longer declared error' at parse time. 
  • an interpreter that wont mess up when I modify the length of a sequence I am iterating over. I get an index error if I remove an element.
for i = 1 to length(s) do 
   if some_condition then 
      -- this causes errors in Euphoria today 
      s = s[1..i-1]  & s[i+1 .. $] 
   end if 
   if some other condition then 
       i += 1 
       -- so does this 
   end if 
end for 

I want loops like these to work.

  • a redo which re-iterates a for loop without incrementing the variable, but in the while with entry loop goes to the entry clause. Between the condition of the loop and the entry clause is invariably where the loop sets up the next iteration. Like line is read, or match is called again.
  • I would like to see 'for (x of s)' like loops from Javascript ( not the syntax but the ability to just get the s[i] in a variable rather than i.
  • statements like b += func(), where func() sets b should throw an error rather than overriding changes of the variable b as the language does now. I'd love someone to convince me why this is a good idea. It is not obvious without understanding the front-end code to some degree, but a lot of effort was put in to make this work consistently this way
  • no more destructors on atoms. It was a misconceived idea which had to be implemented before we realized what problems would be introduced. Internally, the interpreter is designed to convert atoms which are implemented as pointers to structs, which could contain a destructor now, to an atom represented as a C integer, which can only represent a value of an integer. This means innocent looking code can often close your file handle before you can use it. (
atom x = open("foo.txt", "w", 1) 
-- x is an atom because it has a destructor.  x has no fraction part so it should be an integer. 

I propose we make open return a sequence when returning with a destructor with the file handle being the first element. The sequence can contain the destructor.

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


Quick Links

User menu

Not signed in.

Misc Menu