Allen Wirfs-Brock (2013-10-18T17:30:31.000Z)
On Oct 18, 2013, at 10:06 AM, Andrea Giammarchi wrote:

> +1 for the simplified `at(symbolIndex)`
> 
> I would expect '𝌆'.at(1) to fail same way 'a'.charAt(1) or 'a'.charCodeAt(1) would.

They are comparable, as the 'a' example are "index out of bounds" errors. We only use code unit indices with strings so '𝌆'[1] is valid (and so presumably should be '𝌆'.at(1) with 1 having the same meaning in each case.

The most consistent way to define String.prototype.at be be:

String.prototype.at = function(pos} {
    let cp = this.codePointAt(pos);
    return cp===undefined ? undefined : String.fromCodePoint(cp)
}
   
Allen



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131018/eb6dce4e/attachment.html>
domenic at domenicdenicola.com (2013-10-26T03:02:21.117Z)
On Oct 18, 2013, at 10:06 AM, Andrea Giammarchi wrote:

> +1 for the simplified `at(symbolIndex)`
> 
> I would expect `'𝌆'.at(1)` to fail same way `'a'.charAt(1)` or `'a'.charCodeAt(1)` would.

They are comparable, as the `'a'` example are "index out of bounds" errors. We only use code unit indices with strings so `'𝌆'[1]` is valid (and so presumably should be `'𝌆'.at(1)` with 1 having the same meaning in each case.

The most consistent way to define `String.prototype.at` be be:

```js
String.prototype.at = function(pos} {
    let cp = this.codePointAt(pos);
    return cp===undefined ? undefined : String.fromCodePoint(cp)
}
```
domenic at domenicdenicola.com (2013-10-24T14:21:41.233Z)
On Oct 18, 2013, at 10:06 AM, Andrea Giammarchi wrote:

> +1 for the simplified `at(symbolIndex)`
> 
> I would expect '𝌆'.at(1) to fail same way 'a'.charAt(1) or 'a'.charCodeAt(1) would.

They are comparable, as the 'a' example are "index out of bounds" errors. We only use code unit indices with strings so '𝌆'[1] is valid (and so presumably should be '𝌆'.at(1) with 1 having the same meaning in each case.

The most consistent way to define String.prototype.at be be:

```js
String.prototype.at = function(pos} {
    let cp = this.codePointAt(pos);
    return cp===undefined ? undefined : String.fromCodePoint(cp)
}
```