On 01/30/2017 10:04 PM, Peter Broadbery wrote:
>> Well, then the term "domain-valued" means "is a category or a domain".
>> If this was the original idea for the first argument of "has", then I'm
>> fine with it, but the Aldor User Guide should definitely not use
>> "domain-valued", since that had (at least me) confused up to today.
>>
>
> I'll think of a suitable form of words for the user guide in a
> subsequent pull request - there's the simple fix (ie. it's a type),
> plus a second option which will allow more operations on domain-valued
> objects, but needs a bit more thought and discussion.
Thanks.
>>> I don't think they are a strong argument for adding additional
>>> special types into the core language -- and definitely not as part of
>>> this pull request.
>>
>> Oh no... I was not saying to add a keyword "Domain". I am just in favour
>> of adding
>>
>> define Domain: Category == with;
>>
>> to the standard library.
>>
>
> Even this is a relatively large change - every domain would need it,
> even the smaller ones used for testing. It is possible to add "define
> Domain == with" (note the lack of :Category), and this will give you a
> name to use in place of "with". It should mean exactly the same
> thing, as opposed to introducing a new category.
Oh. Good. Now perhaps I will learn the difference between
define Domain: Category == with; (A)
and
define Domain == with; (B)
To be honest, I didn't get the difference. And there would be something
else:
macro Domain == with; (C)
I probably understand (A) and (C), but how exactly do they differ from (B)?
I guess, I would be happy with (B) if it gives me a way to restrict an
argument to domains (in contrast to categories) and is more telling than
with in a situation like "Foo(D: with)".
>> For my taste "Domain" is just a bit more telling then "with", in
>> particular in situations where one just wants to say that the thing can
>> be a domain, but not a category.
> I think we have to disagree here - I do see your point, but then
> consider the use of
> "with" in constructors - eg F(X: with { 1: %}).. would you insist on
> putting "Domain" in front of the with?
Well, in fact, yes. Or rather yes and no. Surely, "Domain" wouldn't add
much information, but on the other hand I'd argue that "1: %" is also
meaningless in the sense that the axioms are missing. Unfortunately,
Aldor doesn't allow me to require some axioms that must be fulfilled.
For example, if I want
F(X: with {+: (%, %) -> %})
then most people will think that + should be an assosiative and
commutative operation. BUT, the compiler cannot check this requirement.
Now if we had
AssociativePlust: Category == with {+: (%, %) -> %}
CommutativePlust: Category == with {+: (%, %) -> %}
then I could write
F(X: Join(AssociativePlus, CommutativePlus)
Yes, that is only a trick to add a bit of meaning to the code that can
be checked by the compiler. Yes that would be cumbersome to write, and I
would be much more happy if I could express commutativity in the Aldor
language by a logical formula, but just writing
F(X: with {+: (%, %) -> %})
is nothing that is algebraically much helpful.
I would want "Domain" to have something similar to "Category" and (as a
bigger wish) I want an option to express axioms of operations in Aldor.
Ralf