On Thu, Aug 01, 2013 at 02:16:36PM +0200, Guido Trotter wrote:
> On Thu, Aug 01, 2013 at 12:41:37PM +0200, Jose A. Lopes wrote:
> > On Wed, Jul 31, 2013 at 03:25:36PM +0200, Guido Trotter wrote:
> > > On Wed, Jul 31, 2013 at 12:55:04PM +0200, Jose A. Lopes wrote:
> > > > From: "Jose A. Lopes" <[email protected]>
> > > > 
> > > > Fix detection of default values for the opcodes. Fix spacing between
> > > > opcode definitions.
> > > 
> > > - Bullet points as bullet points.
> > > - You forgot the "Fix spacing between opcode definitions" in a previous 
> > > patch
> > > - Can you explain why before it was just ht.NoDefault and now it has to be
> > >   "None" too?
> > 
> > The opcodes.py that existed before the Haskell to Python generation
> > was completely inconsistent: sometimes it used None, sometimes it used
> > ht.NoDefault. I made everything consistent by using None. However,
> > there are still some traces of code that test for both. There is also
> > some cryptic code that I couldn't decypher: I couldn't understand what
> > it was trying to do. And because of that I couldn't fix it. This seems
> > to be a deeper problems that spans several Python modules.
> > 
> 
> Mmm... the cryptic code perhaps we should look at better. The rest, ok as long
> as None is not used also as a possible valid value. In that case we need
> something else to define the no default.

The parameter's default value and type predicate play together in the
following way:

if test is ht.TMaybe(...) then the parameter is optional

if default is None and parameter is optional then it is a valid value
and it is ok.

if default is None and parameter is not optional then it won't check
against the type predicate, which is also ok because the Validate
method of OpCode will fail.

> Thanks,
> 
> Guido

Reply via email to