[Swift-devel] Call function.

Mihael Hategan hategan at mcs.anl.gov
Thu Aug 11 14:40:02 CDT 2011


On Thu, 2011-08-11 at 19:09 +0000, Ben Clifford wrote:
> > 1. Keep them in the same namespace, treat all procs as if they were
> > equivalent to name = signature {body}. Disallow variables and procedures
> > with the same name.
> 
> This is what both C and Haskell do, very roughly. 

I'd argue that C does a bit of both the above and x = proc f (x = &f).
And let's not take the credit from ML because it did what Haskell does
before there was a Haskell.

> 
> C has a distinction between functions directly defined, and functions 
> being referenced (by a pointer) - the name of the function invoked as 
> f(x); in the first case, and (*f)(x) in the second case. Haskell treats 
> them the same: f x
> 
> The other two options you give look ugly to me.
> 
> But this project is not about abstract PL research/development - what 
> makes this stuff easier to use?

x = proc f.

The name clash I think would be annoying. Inference (i.e. context
dependent meanings) are not intuitive.

> 
> I'm inclined to think some function type (rather than strings) does, (but 
> I'm very into compile time safety so that's unsurprising) but I'm not sure 
> if its worth the effort for what I think is a fairly restricted use case.
> 

It's restricted because it's not implemented. But we have no (easy) way
of knowing how much it will actually be used should it be there.





More information about the Swift-devel mailing list