Re: Self type

2007-08-17 Thread Peter Hall
PROTECTED] wrote: Peter Hall wrote: On 8/14/07, Eylon Stroh [EMAIL PROTECTED] wrote: From the proposal: The return type T2 is ok, even if the function returns a T1 instead... covariant occurrences of Self (eg in the result type) are replaced by T2 I was also wondering about

Re: 'switch' operator improvement

2007-10-16 Thread Peter Hall
Minor nitpick, but that should be === not ==. I really like the idea, but probably it should be done in a way that could be generalised beyond just the RegExp case. And that doesn't seem like something that can be done in the es4 time-frame. But already you can do something like this: var str;

like and is like

2007-11-14 Thread Peter Hall
After searching through the wiki and ecmascript.org site, I still can't see any formal or informal explanation of how like and is like work, except in passing, and not with precision. Does this information exist somewhere? Peter ___ Es4-discuss mailing

Re: like and is like

2007-11-15 Thread Peter Hall
Thanks. A bit more formal than was expecting, but I think it contains what I'm looking for. Peter On Nov 14, 2007 3:36 PM, Brendan Eich [EMAIL PROTECTED] wrote: On Nov 14, 2007, at 11:40 AM, Peter Hall wrote: After searching through the wiki and ecmascript.org site, I still can't see any

Re: proper tail calls

2008-01-21 Thread Peter Hall
The argument (which I do not think is decisive) is that PTC breaks debugability. I am a bit out of my depth in this discussion, but explicit syntax feels wrong to me. However, if it's going to be implicit, it has to be completely invisible (aside from the benefits) - developers are going to

Re: proper tail calls

2008-01-21 Thread Peter Hall
Tail calls do not have to be self recursive. Only a stack could maintain the necessary state... Ah yes, I see that now. Duh. You can easily circumvent an expression being in tail position. For example, if EXP is in tail position and you want it not to be, just wrap it as: let (r =

Re: Why packages and namespaces?

2008-01-28 Thread Peter Hall
Packages, combined with 'internal', are a specialized subset of namespaces, with usage restrictions and a convenient syntax to cater for a common use case. Namespaces are more general: any declaration (local variables or any function or variable defined in a package, class, structural type or

Re: Extracting getters and setters

2008-02-06 Thread Peter Hall
ES4 needs to treat getter/setters identically to normal vars. Otherwise it kind of defeats the point of having them. I would expect: var fun = width; to *invoke* the getter. In that particular case, I'd expect a compile error because width can't be accessed from static scope, exactly as

Re: new since ActionScript 3.0 lecture notes

2008-02-13 Thread Peter Hall
From the discussions that I can recall, I thought it was to permit more complex type combinations, adding intersection types using . (which is why I like the change). Peter On Feb 13, 2008 11:48 PM, Brendan Eich [EMAIL PROTECTED] wrote: On Feb 13, 2008, at 3:46 PM, Peter Hall wrote

Re: new since ActionScript 3.0 lecture notes

2008-02-13 Thread Peter Hall
- Union types are spelled (x|y|z) now, not (x,y,z). Popularity contest, the pipe character won. Didn't notice that change! (and I like it :)) Peter ___ Es4-discuss mailing list Es4-discuss@mozilla.org

Re: Adobe position paper on the ECMAScript 4 proposal space -- decimal

2008-02-27 Thread Peter Hall
Was decimal ruled out as its own type? Peter On Wed, Feb 27, 2008 at 5:58 PM, Brendan Eich [EMAIL PROTECTED] wrote: On Feb 27, 2008, at 5:33 AM, Lars Hansen wrote: None of the above speaks to the possibility that decimal might be a distinct data type in the language, of course, along

Re: Adobe position paper on the ECMAScript 4 proposal space -- decimal

2008-02-27 Thread Peter Hall
:58 AM To: Peter Hall Cc: es4-discuss Discuss; TC39; Mike Cowlishaw Subject: Re: Adobe position paper on the ECMAScript 4 proposal space -- decimal On Feb 27, 2008, at 10:40 AM, Brendan Eich wrote: First, nothing's ruled out -- you're asking the wrong guy if you want Adobe's

Re: Adobe position paper on the ECMAScript 4 proposal space -- decimal

2008-02-28 Thread Peter Hall
, and bind to the normal method otherwise). Peter On Thu, Feb 28, 2008 at 2:43 PM, Lars Hansen [EMAIL PROTECTED] wrote: -Original Message- From: Dick Sweet Sent: 27. februar 2008 23:27 To: Lars Hansen; 'Peter Hall' Cc: 'Brendan Eich'; 'es4-discuss Discuss'; 'TC39'; 'Mike Cowlishaw

Re: Triple quoted strings

2008-03-05 Thread Peter Hall
Except that it would have a few unexpected behaviours, especially around the and characters. Peter On Wed, Mar 5, 2008 at 11:53 PM, Igor Bukanov [EMAIL PROTECTED] wrote: On 06/03/2008, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: If I understand the motivation for triple quoted strings,

Re: ES4 draft: Object

2008-03-11 Thread Peter Hall
Yuh-Ruey Chen [EMAIL PROTECTED] wrote: Which gets me back to the cognitive load issue. Even with a name like 'hidden', they may think they may have to do some funky syntax like |obj.hidden::other_ns::prop| do hide a prop in another namespace. This was confusing me... How would you define a

Re: ES4 draft: Object

2008-03-11 Thread Peter Hall
The latter. It is weird, I agree. But the enumerator can easily be customized, so I want the default enumerator be as non-magical as possible - and therefore, as simple as possible. In fact, I'm a bit bothered that propertyIsEnumerable is a method of Object yet can be rendered useless

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-11 Thread Peter Hall
If there is no method to make a property enumerable again (which I now agree is better not to exist) it feels somehow bad to be able to make a property non-enumerable after its declaration. Consider: let a = {b:2, c:3}; for(let s in a){ print(s); // b, c } a.__makePropertyNonEnumerable__(b);

Re: Controlling DontEnum (was: ES4 draft: Object)

2008-03-13 Thread Peter Hall
Is there enough value in complicating matters by adding the ability to set dontDelete and readOnly? You can create non-deletable properties by using a class or record type, and you can create read-only properties by adding a get function without a corresponding set... Are there any use cases

Nature of Parametrized types

2008-03-15 Thread Peter Hall
I have a few questions/comments about parametrized types. Some I know has been discussed, but I still unclear on the outcome of those conversations. 1. If there is a type T.J,K, can T be referenced itself, or must it be referenced for some specific values of J and K? That is, can I say: T1 = T;

Re: ES4 draft: Name

2008-03-17 Thread Peter Hall
Perhaps, something like this: var n1 = new Name(foo, bar); var n2 = new Name(foo, bar); n1.toString = function(){.} An implementation might have reasonably shared the same instance for n1 and n2, but a user might be surprised that the new toString() function is now found on what he

union type syntax

2008-03-18 Thread Peter Hall
Now that union type uses | instead of , for the delimiter, could the parentheses be made optional? It seems like parentheses are used elsewhere only for grouping and function calls/definitions. UnionType ::= Type ( | UnionType )? which should be easily distinguishable from a bitwise OR

Re: union type syntax

2008-03-22 Thread Peter Hall
, 2008 at 10:46 PM, Waldemar Horwat [EMAIL PROTECTED] wrote: There is no solid technical reason for requiring parentheses here. They're here because of people's preferences. I don't find them particularly useful here. Waldemar Peter Hall wrote: Now that union type uses | instead

Re: Class method addition and replacement (was Re: AOP Compatibility)

2008-04-03 Thread Peter Hall
Replacing a method effectively changes the type, even if the signature is the same. If some code creates an instance of a class using new it should be able to rely on it being that type, and make assumptions about how that object will behave. (This is not a matter of breaking polymorphism because

Arguments in default constructors and implicit super()

2008-04-15 Thread Peter Hall
Some time last year I started a brief discussion about passing arguments to super() in a constructor, when it is automatically inserted. (https://mail.mozilla.org/pipermail/es4-discuss/2007-June/000846.html) The most common use-case from Flex/AS3 is probably for custom events, where you'd write

Re: Argument matching

2008-05-12 Thread Peter Hall
Since both modes are to be specified by upcoming standards documents, can we adopt some term other than standard for the mode we'd like to discourage? I propose loose. I agree. But I think lenient sounds better. Peter ___ Es4-discuss mailing

Re: Questions about setters

2008-07-25 Thread Peter Hall
Not sure, but there might be something in the super syntax (eg, super.x = 10) that would do this. Hasn't been spec'd yet. Not sure what AS3 does. In AS3 it's like this: override function set bar (value) { super.bar = value; } Peter ___

Re: How to escape implicit 'with (this)' of a method body

2008-07-31 Thread Peter Hall
Here's my take at an example of brittleness: var bar = 42; class foo { function zot () { return bar; } } ... class subfoo extends foo { var bar = 'oops!'; } (new foo).zot() = 42 (new myfoo).zot() = ? In AS3, the reference to bar in the zot function would be bound to this.bar