Label: ♦english ♦feature request

[257] Few suggestions

Comment
    I think I found few minor things in Dao which need to be somewhat improved.
    1) At present Dao allow direct access to private and protected class members only from within corresponding class instance (but not from other instances of the same class!). So the code below will cause an error:
    classX
    {
    protected
         
          var  f  =  0;

    public

          routineX(obj:  X)
          {
                f  =  obj.f;  #access disallowed
          }
    }
    But what if one needs instances of some class to interact with each other? It seems reasonable to have straight communication between them (just like in the example above).
    2) It appears operator ?? works properly with simple (non-aggregate) expressions only. Something like
    if((value:=  Map[key])  ??)
          writeln(key,  '=>',  value);
    won't work as expected. I suppose the ability to use this operator with complex expressions (brackets support, in other words) would be both convenient and correct.
    3) Casting string to int , for instance, returns zero in the case of error. Thus it is impossible to determine if the operation has failed or the string really does contain zero (without checking the string manually). Raising exception instead would probably make things clear, especially assuming that operator ?? could be used in such case.

Comments
  1. Class member accessing:
    I thought it is more logical to have the access permission granted based on class instance. But it is more practical to grant permission based class, as you pointed out. Class based permission is also used in C++. I will also switch it to class based too.
  2. Assertion operator:
    The assertion operator works by suppressing the raised exceptions. It is straightforward to suppress the exception raised by the last instruction. This simple handling is not suitable for complex expression. But just while I am writing, it came to mind that it should be possible to compile assertion in a way similar to compile try{}rescue{} statements, this should work with arbitrary complex expression. I will try it out.
  3. String to number conversion:
    You are right, it is better to raise an expression when the conversion is failed.

Change picture:

Choose file:

123 4
56 78910 11
121314151617 18
192021222324 25
26272829

fu: ... I forgot to say something about the plan for the whole new year in my previous reply. Well, besides w ... (Jan.19,01:40)

fu: ... Happy new dragon year (which will start from this sunday)! Actually, it was a busy month (I wish th ... (Jan.18,22:46)

ybabel: What's the plan for the new year ? Hello 'vry budy :- ) happy new year (when is the new year for you Fu ?) I saw you come back and comm ... (Jan.18,18:59)

This site is powered by Dao
Copyright (C) 2009,2010, daovm.net.
Webmaster: admin@daovm.net