Re: "dict"ionary typing?
Jan Wielemaker <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 11/28/2013 11:08 AM, Kilian Evang wrote:
> I'm also concerned about this. It feels inconsistent.
>
> Couldn't is/2 be overloaded for the purpose of functional assignment, so
> that the above would become
>
> P = point{x:3, y:4}, X is P.x, D is P.polar_radius().
No. For two reasons. First of all, functional notation is intended to
pass arguments to other predicates. Of course, you can use this with
=/2, but that is certainly not intended to be the prime target. Second,
overloading is/2 will hinder type reasoning and efficiency (is/2 is
generally compiled into VM codes).
> I realize the functional notation could not be used directly in goal
> arguments then. But so what? That's Prolog. IMHO a consistent syntax is
> well worth the slight added verbosity.
Before dicts, I was mostly using library(option), library(record), or
library(assoc) to do the job. I've got lots of code using these. I
consider it far too verbose though, and I'm certainly not alone here.
Just look at all the functional extensions for Prolog floating on the
web. Getting the . available as an operator is the one and only
opportunity to do something about this.
Cheers --- Jan