Re: Re: Add "???" Unimplemented

2018-04-04 Thread T.J. Crowder
On Wed, Apr 4, 2018 at 8:11 AM, Thomas Grainger  wrote:
>
> const ɁɁɁ = () => { throw new Error('Method not defined'); };

LOL. Awkward to type on most keyboards, though. :-) Suppose one could use
some form of auto-correct in one's IDE...

-- T.J. Crowder
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Re: Add "???" Unimplemented

2018-04-04 Thread Thomas Grainger
const ɁɁɁ = () => { throw new Error('Method not defined'); };

Thomas Grainger

On 26 March 2018 at 06:26, Isiah Meadows  wrote:

> Even in TypeScript, `never` (the type of functions that never return -
> throwing ≠ returning) is the subtype of *all* types, even primitives.
> -
>
> Isiah Meadows
> m...@isiahmeadows.com
>
> Looking for web consulting? Or a new website?
> Send me an email and we can get started.
> www.isiahmeadows.com
>
>
> On Sun, Mar 25, 2018 at 7:45 PM, dante federici
>  wrote:
> > Not a bad idea -- I agree that it really belongs here, but its value is
> much
> > higher in something like TypeScript, where you can keep the typing
> signature
> > but have a missing implementation.
> >
> >
> > On Sat, Mar 24, 2018 at 3:32 AM Isiah Meadows 
> > wrote:
> >>
> >> I would suggest, if you have support in your editor, just making a
> >> `???` snippet expand to `throw new Error("unimplemented")`. I've been
> >> doing similar (mod the snippet) for a while, and it's worked pretty
> >> well.
> >> -
> >>
> >> Isiah Meadows
> >> m...@isiahmeadows.com
> >>
> >> Looking for web consulting? Or a new website?
> >> Send me an email and we can get started.
> >> www.isiahmeadows.com
> >>
> >>
> >> On Fri, Mar 23, 2018 at 11:16 AM, dante federici
> >>  wrote:
> >> > Simple example (ts):
> >> > ```typescript
> >> > interface SearchFunc {
> >> > (source: string, subString: string): boolean;
> >> > }
> >> >
> >> > // Later
> >> > let mySearch: SearchFunc;
> >> > mySearch = function(source: string, subString: string) {  ??? }
> >> > ```
> >> >
> >> > Simple example (js):
> >> > ```js
> >> > class MyClass = {
> >> >   foo() { return "foo"; }
> >> >   bar() { return "bar"; }
> >> > }
> >> > class ExtendClass extends MyClass {
> >> > foo(){ ??? }
> >> > bar(){ return `extended bar`; }
> >> > }
> >> >
> >> > // Elsewhere
> >> > myRunner = (classInstance) => `${classInstance.foo()} ::
> >> > ${classInstance.bar()}`;
> >> >
> >> > myRunner(myClassInstance);
> >> > myRunner(extendedClassInstance);
> >> > ```
> >> >
> >> > Decorations would be good for classes, but don't work for regular
> >> > methods.
> >> >
> >> > I'm not sold we need new syntax for this -- I just find myself
> reaching
> >> > for
> >> > the `???` symbol. Especially in a typed language or in any instance
> that
> >> > we
> >> > have a class and extended paradigm, or when you have a prescribed
> >> > "object"
> >> > shape.
> >> >
> >> > ___
> >> > es-discuss mailing list
> >> > es-discuss@mozilla.org
> >> > https://mail.mozilla.org/listinfo/es-discuss
> >> >
> >
> >
> > ___
> > es-discuss mailing list
> > es-discuss@mozilla.org
> > https://mail.mozilla.org/listinfo/es-discuss
> >
> ___
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Re: Add "???" Unimplemented

2018-03-25 Thread Isiah Meadows
Even in TypeScript, `never` (the type of functions that never return -
throwing ≠ returning) is the subtype of *all* types, even primitives.
-

Isiah Meadows
m...@isiahmeadows.com

Looking for web consulting? Or a new website?
Send me an email and we can get started.
www.isiahmeadows.com


On Sun, Mar 25, 2018 at 7:45 PM, dante federici
 wrote:
> Not a bad idea -- I agree that it really belongs here, but its value is much
> higher in something like TypeScript, where you can keep the typing signature
> but have a missing implementation.
>
>
> On Sat, Mar 24, 2018 at 3:32 AM Isiah Meadows 
> wrote:
>>
>> I would suggest, if you have support in your editor, just making a
>> `???` snippet expand to `throw new Error("unimplemented")`. I've been
>> doing similar (mod the snippet) for a while, and it's worked pretty
>> well.
>> -
>>
>> Isiah Meadows
>> m...@isiahmeadows.com
>>
>> Looking for web consulting? Or a new website?
>> Send me an email and we can get started.
>> www.isiahmeadows.com
>>
>>
>> On Fri, Mar 23, 2018 at 11:16 AM, dante federici
>>  wrote:
>> > Simple example (ts):
>> > ```typescript
>> > interface SearchFunc {
>> > (source: string, subString: string): boolean;
>> > }
>> >
>> > // Later
>> > let mySearch: SearchFunc;
>> > mySearch = function(source: string, subString: string) {  ??? }
>> > ```
>> >
>> > Simple example (js):
>> > ```js
>> > class MyClass = {
>> >   foo() { return "foo"; }
>> >   bar() { return "bar"; }
>> > }
>> > class ExtendClass extends MyClass {
>> > foo(){ ??? }
>> > bar(){ return `extended bar`; }
>> > }
>> >
>> > // Elsewhere
>> > myRunner = (classInstance) => `${classInstance.foo()} ::
>> > ${classInstance.bar()}`;
>> >
>> > myRunner(myClassInstance);
>> > myRunner(extendedClassInstance);
>> > ```
>> >
>> > Decorations would be good for classes, but don't work for regular
>> > methods.
>> >
>> > I'm not sold we need new syntax for this -- I just find myself reaching
>> > for
>> > the `???` symbol. Especially in a typed language or in any instance that
>> > we
>> > have a class and extended paradigm, or when you have a prescribed
>> > "object"
>> > shape.
>> >
>> > ___
>> > es-discuss mailing list
>> > es-discuss@mozilla.org
>> > https://mail.mozilla.org/listinfo/es-discuss
>> >
>
>
> ___
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Re: Add "???" Unimplemented

2018-03-25 Thread dante federici
Not a bad idea -- I agree that it really belongs here, but its value is
much higher in something like TypeScript, where you can keep the typing
signature but have a missing implementation.

On Sat, Mar 24, 2018 at 3:32 AM Isiah Meadows 
wrote:

> I would suggest, if you have support in your editor, just making a
> `???` snippet expand to `throw new Error("unimplemented")`. I've been
> doing similar (mod the snippet) for a while, and it's worked pretty
> well.
> -
>
> Isiah Meadows
> m...@isiahmeadows.com
>
> Looking for web consulting? Or a new website?
> Send me an email and we can get started.
> www.isiahmeadows.com
>
>
> On Fri, Mar 23, 2018 at 11:16 AM, dante federici
>  wrote:
> > Simple example (ts):
> > ```typescript
> > interface SearchFunc {
> > (source: string, subString: string): boolean;
> > }
> >
> > // Later
> > let mySearch: SearchFunc;
> > mySearch = function(source: string, subString: string) {  ??? }
> > ```
> >
> > Simple example (js):
> > ```js
> > class MyClass = {
> >   foo() { return "foo"; }
> >   bar() { return "bar"; }
> > }
> > class ExtendClass extends MyClass {
> > foo(){ ??? }
> > bar(){ return `extended bar`; }
> > }
> >
> > // Elsewhere
> > myRunner = (classInstance) => `${classInstance.foo()} ::
> > ${classInstance.bar()}`;
> >
> > myRunner(myClassInstance);
> > myRunner(extendedClassInstance);
> > ```
> >
> > Decorations would be good for classes, but don't work for regular
> methods.
> >
> > I'm not sold we need new syntax for this -- I just find myself reaching
> for
> > the `???` symbol. Especially in a typed language or in any instance that
> we
> > have a class and extended paradigm, or when you have a prescribed
> "object"
> > shape.
> >
> > ___
> > es-discuss mailing list
> > es-discuss@mozilla.org
> > https://mail.mozilla.org/listinfo/es-discuss
> >
>
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Re: Add "???" Unimplemented

2018-03-24 Thread Isiah Meadows
I would suggest, if you have support in your editor, just making a
`???` snippet expand to `throw new Error("unimplemented")`. I've been
doing similar (mod the snippet) for a while, and it's worked pretty
well.
-

Isiah Meadows
m...@isiahmeadows.com

Looking for web consulting? Or a new website?
Send me an email and we can get started.
www.isiahmeadows.com


On Fri, Mar 23, 2018 at 11:16 AM, dante federici
 wrote:
> Simple example (ts):
> ```typescript
> interface SearchFunc {
> (source: string, subString: string): boolean;
> }
>
> // Later
> let mySearch: SearchFunc;
> mySearch = function(source: string, subString: string) {  ??? }
> ```
>
> Simple example (js):
> ```js
> class MyClass = {
>   foo() { return "foo"; }
>   bar() { return "bar"; }
> }
> class ExtendClass extends MyClass {
> foo(){ ??? }
> bar(){ return `extended bar`; }
> }
>
> // Elsewhere
> myRunner = (classInstance) => `${classInstance.foo()} ::
> ${classInstance.bar()}`;
>
> myRunner(myClassInstance);
> myRunner(extendedClassInstance);
> ```
>
> Decorations would be good for classes, but don't work for regular methods.
>
> I'm not sold we need new syntax for this -- I just find myself reaching for
> the `???` symbol. Especially in a typed language or in any instance that we
> have a class and extended paradigm, or when you have a prescribed "object"
> shape.
>
> ___
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Re: Add "???" Unimplemented

2018-03-23 Thread dante federici
Simple example (ts):
```typescript
interface SearchFunc {
(source: string, subString: string): boolean;
}

// Later
let mySearch: SearchFunc;
mySearch = function(source: string, subString: string) {  ??? }
```

Simple example (js):
```js
class MyClass = {
  foo() { return "foo"; }
  bar() { return "bar"; }
}
class ExtendClass extends MyClass {
foo(){ ??? }
bar(){ return `extended bar`; }
}

// Elsewhere
myRunner = (classInstance) => `${classInstance.foo()} ::
${classInstance.bar()}`;

myRunner(myClassInstance);
myRunner(extendedClassInstance);
```

Decorations would be good for classes, but don't work for regular methods.

I'm not sold we need new syntax for this -- I just find myself reaching for
the `???` symbol. Especially in a typed language or in any instance that we
have a class and extended paradigm, or when you have a prescribed "object"
shape.
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Add "???" Unimplemented

2018-03-21 Thread Augusto Moura
I think it can be easily implemented with decorators (
https://github.com/tc39/proposal-decorators).
Something like `@unimplemented`.

In my opinion it doesn't offer enough benefits to be added as a new syntax.

Em qua, 21 de mar de 2018 às 04:02, Naveen Chawla 
escreveu:

> Can you give a simple example?
>
> On Wed, 21 Mar 2018 at 00:44 dante federici 
> wrote:
>
>> With the advent of TypeScript, classes, etc one feature I liked from
>> scala is: `???`, the [Predef.???](
>> https://www.scala-lang.org/api/current/scala/NotImplementedError.html)
>> token.
>>
>> Basically, you can place `???` which would type as whatever the method is
>> typed as (for things like Typescript, Symbol definitions, etc.), and when
>> run, throws the "NotImplementedError".
>>
>> This is useful when writing libraries or other code -- more readable that
>> "cannot call undefined" when the method is missing, and a nice placeholder
>> for young APIs.
>>
>> This is basically the same as writing: `throw new Error('Unimplemented')`.
>> ___
>> es-discuss mailing list
>> es-discuss@mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
> ___
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-- 
Augusto Moura
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Add "???" Unimplemented

2018-03-21 Thread Naveen Chawla
Can you give a simple example?

On Wed, 21 Mar 2018 at 00:44 dante federici 
wrote:

> With the advent of TypeScript, classes, etc one feature I liked from scala
> is: `???`, the [Predef.???](
> https://www.scala-lang.org/api/current/scala/NotImplementedError.html)
> token.
>
> Basically, you can place `???` which would type as whatever the method is
> typed as (for things like Typescript, Symbol definitions, etc.), and when
> run, throws the "NotImplementedError".
>
> This is useful when writing libraries or other code -- more readable that
> "cannot call undefined" when the method is missing, and a nice placeholder
> for young APIs.
>
> This is basically the same as writing: `throw new Error('Unimplemented')`.
> ___
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss