#7520: Improving word construction
-----------------------------+----------------------------------------------
   Reporter:  slabbe         |       Owner:  slabbe         
       Type:  enhancement    |      Status:  needs_review   
   Priority:  major          |   Milestone:  sage-4.3.1     
  Component:  combinatorics  |    Keywords:                 
Work_issues:                 |      Author:  Sebastien Labbe
   Upstream:  N/A            |    Reviewer:                 
     Merged:                 |  
-----------------------------+----------------------------------------------
Changes (by slabbe):

  * status:  needs_work => needs_review


Comment:

 > I am changing the status to "needs work" because I thought of a cleaner
 way of solving this.

 I still think that the construction of words is not clean, but I will not
 clean it in this ticket. This ticket solves some problems and I believe it
 can now get a review and an eventual merge into sage.

 Here are some key points I am actually thinking (I am writing them as a
 reference for future improvements):

  - The first version of sage-words got merged into sage in the end of
 December 2008. In January 2009, we quickly realized that many improvements
 should be done to the library (involving word construction, reorganisation
 of the classes and of course, many pickle problem...). In July 2009, the
 big reorganisation was merged into sage without breaking any pickle
 (Thanks to Franco for the quirk).
  - The code now looks really ugly for supporting the old pickled objects
 and I don't like ugly code.
  - I am looking forward to get rid of word_content, utils and friends.
  - I don't hide that I would be happy to have the right to break the
 pickle of the old word objects and replace the ugly code by clean and
 simple code.
  - Looking afterward, I think we should not have supported any pickling of
 word objects for the first year (by suggesting the users to save their
 word objects as lists). Doing so, it would have allow some time for us to
 find really what we think is the good solution for classes and word
 constructors.
  - `CallableFromListOfWords` inherits from tuple which I think is bad
 because (1) it doesn't have to and (2) it is the only last reason why one
 must use the datatype='callable' for word creation.
  - Then, get rid of the datatype argument.
  - I think that creating classes inline from bases classes (`MathObject` +
 `DataObject`) would work. And, in this case, `__reduce__` should not
 return a class as first argument but the usual Word function. Did Nicolas
 ThiƩry convinced anyone about creating inline classes? Was it used in the
 lastly merged category code?
  - `WordDatatype_callable` is storing its data into the attributes
 `self._func` while I think all those `WordDatatype` should save their data
 into the same `self._data`.
  - When writing a `__reduce__` function, always make sure to put only
 essential things because this might become a problematic argument to be
 supported by creation function in the future. Moreover, the first argument
 of the tuple returned should be think as a function (or a class) that will
 always exist.
  - Right now only `WordDatatype` provide `__reduce__` function. Now, what
 if the `FiniteWord_class` now wants to store some attributes. How to set
 them again after loading a pickle word? It might work by defining
 `__setstate__` and `__getstate__` for `FiniteWord_class`... To be checked!
 I would be great if we could do it without defining any function in the
 (inline) classes like `FiniteWord_list`.

 > I will fold the two actual patches, improve them and post a new patch
 soon...

 So I did folded the two actual patches. I also updated the description of
 the patch to help the review. The patch now needs review!

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7520#comment:8>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB
-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.


Reply via email to