[Nickle]Removing type names from literal structured values (was: Re: crashing nickle in <100 bytes)

Bart Massey nickle@nickle.org
Thu, 25 Jul 2002 22:57:11 -0700


Maybe can't do it if you want parametric polymorphism more
(and you do).  Sorry.  More later when I have more typing
time.

	Bart

In message <15680.13149.780534.682637@scream.east.isi.edu> you wrote:
> On Jul 23, Keith Packard wrote:
>  > > One thing that I would like is if I could assign a structured value
>  > > without explicitly providing its type, (in the same style as the
>  > > initializer)
>  > 
>  > Yes, that would be nifty, but it requires transmitting type information 
>  > backwards across the assignment operator.  As these values can occur in 
>  > any expression context, the general solution requires fairly complete type 
>  > inference which is about to be thrown out the window in favor of algebraic 
>  > types.
> 
> I don't actually want the complete type interference. Here's where I'm
> at as a programmer:
> 
> 1) I like to provide types for variables, function arguments, and
>    function returns.
> 
> 2) I don't like having to provide the types for literal structured
>    values when they are used in any of the above contexts.
> 
> 3) I don't mind having to provide the type if a literal structured
>    value is used in other contexts within an expression.
> 
> So, my proposal would only reflect type information backwards across
> assignment, passing arguments to functions, and return
> statements. Would that be reasonable?
> 
> If nickle supported this, then anonymous arrays could provide a more
> flexible approach to variable length argument lists with minimal extra
> typing on the part of the programmer:
> 
> 	int foo(int[*] args) {
> 		...
> 	}
> 
> 	int bar(int[*] args, int[*] other_args) {
> 		foo(args);
> 		...
> 	}
> 
> 	bar({1, 2, 3}, {4, 5, 6});
> 
> That would be most pleasant. What do you think?
> 
> I might not go as far as getting rid of the current variable-length
> argument list functionality in favor of anonymous arrays. I don't
> know if I could ever get used to typing extra braces in printf. ;-)
> 
> So, even with this, I'd probably still want the new "args ..." syntax
> for passing an array to a function accepting "args ...".
> 
> -Carl
> 
> -- 
> Carl Worth                                        
> USC Information Sciences Institute                 cworth@east.isi.edu
> 3811 N. Fairfax Dr. #200, Arlington VA 22203		  703-812-3725
> 
> _______________________________________________
> Nickle mailing list
> Nickle@nickle.org
> http://nickle.org/mailman/listinfo/nickle