Hi Robert,

> It's surprising that we end up catching SyntaxErrors!

Isn't it? I'll try to make a reproducible example.

> Yes, I think we could greatly reduce the number of exceptions caught.  
> At most, TypeError, NotImplementedError, and perhaps ValueError.  

Great!

> Also, I think I could reduce the number of places things are caught.  
> Sometimes it would make things more messy, like not being able to  
> catch attribute/key errors in as large of a block (or explicitly  
> testing for them via hasattr/haskey, which is slower).

Out of curiosity: usually, this coercion resolution is done only once,
so the extra cost of an hasattr should not be that critical, or is it?

> > Or even: does this exception handling play any role upon startup? In
> > principle things should be in a fairly sane and predictible state so
> > that one could possible avoid all guess work. If yes, one could simply
> > completely disable exception catching until the initialization is
> > finished?
> 
> Most of the errors caught are because it's trying to detect an  
> action, i.e. given a*b, it tries out a._rmul_(b) and, if successful,  
> registers that as an action, but otherwise goes on to try the next  
> thing. The benefit of this is convenience to the author--you just  
> have to implement an _rmul_ method on your elements and it works. Of  
> course, as you have indicated, this does have its drawbacks.

Yup. That was one advantage of registering explicitly the operations
to the overloading resolution mechanism as we did in MuPAD (but of
course that registration should be taken care of automatically as
often as possible by the category framework). Well, we are not there
yet anyway.

> This may also be relevant: http://trac.sagemath.org/sage_trac/ticket/4986

Cool diagnostic tool. Thanks for the pointer. I'll try it!

> > This issue by itself has readily wasted by accumulation at least one
> > if not two good weeks of developer time, so urgent help would be
> > really appreciated.
> 
> Wish you had brought this up sooner. The other day I was looking at  
> that code and thinking "oh, I could get rid of catching stuff there"  
> but as it wasn't relevant to what I was doing at the time and I  
> didn't see any urgency it went on my "todo later" list. I'll put up a  
> patch soon.

Yeah, sorry about that. It's one of those annoying itches that are
just not annoying enough to get you to start fighting against on the
spot. But then after a long while you just explode and realize how
much time you wasted because of it ...

Thanks much for your help!
                                Nicolas
--
Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to