Multiple declarations

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple declarations

Michael O'Brien-4
Is the following valid?


var x = 2
var x = 3


The ES4 RI prevents this. ASC redefines x.

What should this do?

Michael
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Multiple declarations

Jeff Dyer
Works for me in the RI:

   >> var x = 10; var x = 20; print(x)
   20

As it should.

Jd

On 5/1/08 4:07 PM, Michael O'Brien wrote:

> Is the following valid?
>
>
> var x = 2
> var x = 3
>
>
> The ES4 RI prevents this. ASC redefines x.
>
> What should this do?
>
> Michael
> _______________________________________________
> Es4-discuss mailing list
> [hidden email]
> https://mail.mozilla.org/listinfo/es4-discuss

_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Multiple declarations

Graydon Hoare-3
Jeff Dyer wrote:
> Works for me in the RI:
>
>    >> var x = 10; var x = 20; print(x)
>    20
>
> As it should.

Could be an old build? Check one of the snapshots.

http://buildbot.ecmascript.org/es4/waterfall

-Graydon
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Multiple declarations

Michael O'Brien-4
Thanks - a new build fixed it.

Michael


On May 1, 2008, at 4:14 PM, Graydon Hoare wrote:

> Jeff Dyer wrote:
>> Works for me in the RI:
>>   >> var x = 10; var x = 20; print(x)
>>   20
>> As it should.
>
> Could be an old build? Check one of the snapshots.
>
> http://buildbot.ecmascript.org/es4/waterfall
>
> -Graydon

_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Multiple declarations

Michael O'Brien-4
In reply to this post by Jeff Dyer
Follow up:

The RI allows typed redeclarations providing the type is not double.  
This works:

// var x:double = 7
// delete x

var x:boolean = true
delete x

var x:string = "there"
delete x

var x:boolean = false
delete x

var x = false
delete x


But uncomment the first declaration and you get:

defining ...
**ERROR** FixtureError: incompatible redefinition of fixture name: x  
(near t.as:1:1-1.3)


I presume this is an RI bug?


Michael



On May 1, 2008, at 4:12 PM, Jeff Dyer wrote:

> Works for me in the RI:
>
>>> var x = 10; var x = 20; print(x)
>   20
>
> As it should.
>
> Jd
>
> On 5/1/08 4:07 PM, Michael O'Brien wrote:
>
>> Is the following valid?
>>
>>
>> var x = 2
>> var x = 3
>>
>>
>> The ES4 RI prevents this. ASC redefines x.
>>
>> What should this do?
>>
>> Michael
>> _______________________________________________
>> Es4-discuss mailing list
>> [hidden email]
>> https://mail.mozilla.org/listinfo/es4-discuss
>

_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

RE: Multiple declarations

Lars Hansen-3
Should be a bug.  The rule that's been considered is that redefinition
is allowed if the annotations are equal (either missing or the same
type).

--lars

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Michael O'Brien
> Sent: 2. mai 2008 14:02
> To: Jeff Dyer
> Cc: es4-discuss Discuss
> Subject: Re: Multiple declarations
>
> Follow up:
>
> The RI allows typed redeclarations providing the type is not double.  
> This works:
>
> // var x:double = 7
> // delete x
>
> var x:boolean = true
> delete x
>
> var x:string = "there"
> delete x
>
> var x:boolean = false
> delete x
>
> var x = false
> delete x
>
>
> But uncomment the first declaration and you get:
>
> defining ...
> **ERROR** FixtureError: incompatible redefinition of fixture
> name: x (near t.as:1:1-1.3)
>
>
> I presume this is an RI bug?
>
>
> Michael
>
>
>
> On May 1, 2008, at 4:12 PM, Jeff Dyer wrote:
> > Works for me in the RI:
> >
> >>> var x = 10; var x = 20; print(x)
> >   20
> >
> > As it should.
> >
> > Jd
> >
> > On 5/1/08 4:07 PM, Michael O'Brien wrote:
> >
> >> Is the following valid?
> >>
> >>
> >> var x = 2
> >> var x = 3
> >>
> >>
> >> The ES4 RI prevents this. ASC redefines x.
> >>
> >> What should this do?
> >>
> >> Michael
> >> _______________________________________________
> >> Es4-discuss mailing list
> >> [hidden email]
> >> https://mail.mozilla.org/listinfo/es4-discuss
> >
>
> _______________________________________________
> Es4-discuss mailing list
> [hidden email]
> https://mail.mozilla.org/listinfo/es4-discuss
>
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss