Although the compiler messages have changed, there is a long-standing bug with 
delegates and the ternary operator: 
https://bugzilla.gnome.org/show_bug.cgi?id=599349

-- Jim

On Wed, Feb 13, 2013 at 11:48 AM, Albert Hopkins <mar...@letterboxes.org> wrote:


On Wed, Feb 13, 2013, at 01:49 PM, Albert Hopkins wrote: 
[...] 
> MyDel del; 
> ... 
> del = randValue > 50 ? program.PrintLow : program.PrintHigh; 
> 
> However this gives me a compile error: 
> 
> delegate.vala:21.32-21.47: error: Assignment: Cannot convert from 
> `Program.PrintLow' to `Program.PrintLow' 
> del = randValue < 50 ? program.PrintLow : program.PrintHigh; 
> ^^^^^^^^^^^^^^^^ 
> delegate.vala:21.51-21.67: error: Assignment: Cannot convert from 
> `Program.PrintHigh' to `Program.PrintHigh' 
> del = randValue < 50 ? program.PrintLow : program.PrintHigh; 
> ^^^^^^^^^^^^^^^^^ 
> delegate.vala:21.15-21.28: error: Incompatible expressions 
> del = randValue < 50 ? program.PrintLow : program.PrintHigh; 
> ^^^^^^^^^^^^^^ 
> Compilation failed: 3 error(s), 0 warning(s) 

This works: 

(randValue < 50)? del = Program.PrintLow: del = Program.PrintHigh; 

Although I would like to understand better why the former does not. 

-a 
_______________________________________________ 
vala-list mailing list 
vala-list@gnome.org 
https://mail.gnome.org/mailman/listinfo/vala-list 

_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to