rfc: rdbms - new type system

Ulf Wiger (AL/EAB) <>
Tue Feb 28 11:09:34 CET 2006

Ulf Wiger wrote:
> I'm toying with the idea of allowing a match specification
> as a table-level 'type' specification:
> Ms = [{{1,2,'$1'}, [{is_integer,'$1'}], [{{1,2,{float,'$1'}}}]}].
> [{{1,2,'$1'},[{is_integer,'$1'}],[{{1,2,{float,'$1'}}}]}]
> 10> ets:match_spec_run([{1,2,3}],ets:match_spec_compile(Ms)).
> [{1,2,3.00000}]

Why did this work at all, btw?

Re-reading the manual, I couldn't find mention of 
{float,'$1'} as a valid term construct.

After having inserted code in rdbms to allow for a 
match spec as an input or output filter (basically
a term rewriting filter, or just a record-level
type check), I started thinking that perhaps the 
most useful rewriting op of all would be list_to_binary
(and binary_to_list in the output filter)

But list_to_binary obviously doesn't work in a match
spec. Why not? And why does {float,'$1'} work?

/Ulf W

More information about the erlang-questions mailing list