Talk:List of declarations

From Dyna

Jump to: navigation, search

letotaolomo

What happens if the user tries to declare a union of no types? Should be a compile-time error, I think.
No, because the union inference infers empty unions, like :- union(dyna_foreign, []). if no foreign terms are used. Of course, it could leave the whole declaration out in such a case. But currently, it just declares an empty union. --Markus 10:24, 4 Apr 2005 (EDT)
What happens if the user tries to declare :- union(foo,[int]), or both :- union(bar,[a,b]) and :- union(baz,[a,b])? We could end up (accidentally or deliberately) with two names for basically the same type. However, this might be useful. The different names could have different storage disciplines, and they indicate different usages in both Dyna and C++. After all, there's nothing wrong in having both :- type(foo(int i)) and :- type(bar(int i)). There should be no implicit cast in this case, since the point is to keep the two types distinct, but explicit cast should be free (no runtime check necessary).
Type declaration inference does get a little trickier in this case if we want the inferred declarations, and the resulting C++ classes, to respect the user's distinction between bar and baz. We should track this distinction by temporarily adding _bar and _baz to the respective unions (and their supertypes).
Personal tools