[haXe] Getter & Setter problems

Luke Schreur luke.schreur at profero.com.au
Wed Aug 1 07:28:35 CEST 2007


Hi,

> but you'll soon love that one in haXe.

Why?

> http://haxe.org/ref#properties

Thats what I'm looking at. Missed the return statement (must be my  
dyslectic nature and the fact that I totally didn't expect a return  
statement in a setter in the first place :)

Thanks!


On 01/08/2007, at 4:15 PM, bbsound wrote:

> Hi and welcome,
> The properties thingy is a little confusing if you come from the  
> worlds where setter don't return anything
> but you'll soon love that one in haXe.
>
> Check again at
> http://haxe.org/ref#properties
>
> you're missing "return my_x"
> in your setX
>
> Cheers
> BB
>
> Luke Schreur a écrit :
>>
>> Hi guys,
>>
>> First post to this list so please be gentle. I've run into a  
>> problem with getter and setters. I actually wanted to create a  
>> singleton with static getter and setters but I already had issues  
>> with getting the example of the haXe site up and running. I'm  
>> getting the following error and I'm sure its my mistake but I  
>> can't seem to be able to see it:
>>
>> ./src/Test.hx:7: characters 8-31 : In method setX required by  
>> property x
>> ./src/Test.hx:7: characters 8-31 : x : Int -> Void should be Int - 
>> > Int
>> ./src/Test.hx:7: characters 8-31 : Void should be Int
>>
>> class Test {
>> public var x(getX,setX) : Int; // this is line 7
>>
>>
>> private var m_x : Int;
>>
>>
>> private function getX()
>> {
>> return( m_x );
>> }
>>
>>
>> private function setX( x : Int )
>> {
>> m_x = x;
>> }
>> }
>>
>> I'm running haxe-1.14-osx. Anyone an idea?
>>
>> Thanks.
>>
>
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>
>


LUKE.SCHREUR | WEB DEVELOPER
PROFERO.COM.AU
FIVE WAYS 220A GLENMORE ROAD PADDINGTON NSW 2021
LUKE.SCHREUR at PROFERO.COM.AU | T +61 2 8915 1870



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20070801/11c11a06/attachment.htm


More information about the Haxe mailing list