[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[imp-dev] A proposed API change in Type

Hi!

I'd like to propose an API change for the match method in Type. It's now:
  void match(Type pattern, Map<Type,Type> bindings) throws FactMatchException;

When the match succeeds the bindings contain a map from type
parameters to bound types, when the match fails the method throws an
exception. This method is implemented in all alternative sub-classes
of types (interpreter design pattern).

The issue is that failure is quite a common case when matching
composite type structures and so the exception gets thrown quite
often. This leads to bad performance here and there.

So, I'd like to propose a change to:
  boolean match(Type pattern, Map<Type,Type> bindings);

and ask you to change your code accordingly after where necessary. Is this ok?

Cheers,

Jurgen

-- 
Jurgen Vinju
- Centrum Wiskunde & Informatica - SEN1
- INRIA Lille - ATEAMS
- Universiteit van Amsterdam

  www: http://jurgen.vinju.org,
http://www.rascal-mpl.org,http://twitter.com/jurgenvinju
skype: jurgen.vinju