Re: es-discuss Digest, Vol 140, Issue 26

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

Re: es-discuss Digest, Vol 140, Issue 26

Dan Aprahamian
Is there a good way to get involved in the development of this proposal?

On Thu, Oct 18, 2018 at 8:01 AM <[hidden email]> wrote:
Send es-discuss mailing list submissions to
        [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
        https://mail.mozilla.org/listinfo/es-discuss
or, via email, send a message with subject or body 'help' to
        [hidden email]

You can reach the person managing the list at
        [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of es-discuss digest..."
Today's Topics:

   1. Re: Has there ever been discussion around a python-like
      "with" syntax? (Michael J. Ryan)



---------- Forwarded message ----------
From: "Michael J. Ryan" <[hidden email]>
To: [hidden email]
Cc: [hidden email], es-discuss <[hidden email]>
Bcc: 
Date: Wed, 17 Oct 2018 13:19:17 -0700
Subject: Re: Has there ever been discussion around a python-like "with" syntax?
I was going to mention C#'s using statement as well... though I do like the use of a symbol over Ron's proposal, I think using might be a better approach.

-- 
Michael J. Ryan
<a href="tel:(480)%20270-4509" value="+14802704509" target="_blank">480-270-4509


On Mon, Oct 15, 2018 at 11:50 AM Till Schneidereit <[hidden email]> wrote:
Ron Buckton has a proposal that's quite similar to what you're talking about: https://github.com/tc39/proposal-using-statement

On Mon, Oct 15, 2018 at 11:40 AM Dan Aprahamian <[hidden email]> wrote:
Hello all! First time posting here. I was curious if there was ever talk about adding something similar to python's with syntax to JS. Obviously we already have a "with" keyword, but I figure we could probably use "use" as the keyword instead. I was thinking something like

// Some user defined resource that can be "entered" and "exited"
class MyResource {
  // Function called when entered
  async [Symbol.enter]() {
  }

  // Function called when exited
  [Symbol.exit]() {
  }
}

const resource = new MyResource();

async function useResource() {
  use myResource {
    // Inside here, resource has had "acquire" called on it

    await doSomethingAsync();
    // Once this block is finished executing (including async)
    // release is called
  }
  // Release has been called now
}

Use would effectively be the equivalent of:

async function use(resource, body) {
  await resource[Symbol.enter]();
  try {
    await body();
  } finally {
    await resource[Symbol.exit]();
  }
}

Has something like this been considered before?

Thanks,
Dan
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

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

Re: es-discuss Digest, Vol 140, Issue 26

Peter Jaszkowiak
> When replying, please edit your Subject line so it is more specific than "Re: Contents of es-discuss digest..."

I have no idea which proposal you're talking about.

On Thu, Nov 8, 2018, 08:18 Dan Aprahamian <[hidden email] wrote:
Is there a good way to get involved in the development of this proposal?

On Thu, Oct 18, 2018 at 8:01 AM <[hidden email]> wrote:
Send es-discuss mailing list submissions to
        [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
        https://mail.mozilla.org/listinfo/es-discuss
or, via email, send a message with subject or body 'help' to
        [hidden email]

You can reach the person managing the list at
        [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of es-discuss digest..."
Today's Topics:

   1. Re: Has there ever been discussion around a python-like
      "with" syntax? (Michael J. Ryan)



---------- Forwarded message ----------
From: "Michael J. Ryan" <[hidden email]>
To: [hidden email]
Cc: [hidden email], es-discuss <[hidden email]>
Bcc: 
Date: Wed, 17 Oct 2018 13:19:17 -0700
Subject: Re: Has there ever been discussion around a python-like "with" syntax?
I was going to mention C#'s using statement as well... though I do like the use of a symbol over Ron's proposal, I think using might be a better approach.

-- 
Michael J. Ryan
<a href="tel:(480)%20270-4509" value="+14802704509" rel="noreferrer noreferrer" target="_blank">480-270-4509


On Mon, Oct 15, 2018 at 11:50 AM Till Schneidereit <[hidden email]> wrote:
Ron Buckton has a proposal that's quite similar to what you're talking about: https://github.com/tc39/proposal-using-statement

On Mon, Oct 15, 2018 at 11:40 AM Dan Aprahamian <[hidden email]> wrote:
Hello all! First time posting here. I was curious if there was ever talk about adding something similar to python's with syntax to JS. Obviously we already have a "with" keyword, but I figure we could probably use "use" as the keyword instead. I was thinking something like

// Some user defined resource that can be "entered" and "exited"
class MyResource {
  // Function called when entered
  async [Symbol.enter]() {
  }

  // Function called when exited
  [Symbol.exit]() {
  }
}

const resource = new MyResource();

async function useResource() {
  use myResource {
    // Inside here, resource has had "acquire" called on it

    await doSomethingAsync();
    // Once this block is finished executing (including async)
    // release is called
  }
  // Release has been called now
}

Use would effectively be the equivalent of:

async function use(resource, body) {
  await resource[Symbol.enter]();
  try {
    await body();
  } finally {
    await resource[Symbol.exit]();
  }
}

Has something like this been considered before?

Thanks,
Dan
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

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

Re: Has there ever been discussion around a python-like "with" syntax

Dan Aprahamian
Sorry for spamming, forgot to edit subject line.

Anyway, is there a good way to get involved with https://github.com/tc39/proposal-using-statement?

Thanks,
Dan

On Thu, Nov 8, 2018 at 10:21 AM Peter Jaszkowiak <[hidden email]> wrote:
> When replying, please edit your Subject line so it is more specific than "Re: Contents of es-discuss digest..."

I have no idea which proposal you're talking about.

On Thu, Nov 8, 2018, 08:18 Dan Aprahamian <[hidden email] wrote:
Is there a good way to get involved in the development of this proposal?

On Thu, Oct 18, 2018 at 8:01 AM <[hidden email]> wrote:
Send es-discuss mailing list submissions to
        [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
        https://mail.mozilla.org/listinfo/es-discuss
or, via email, send a message with subject or body 'help' to
        [hidden email]

You can reach the person managing the list at
        [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of es-discuss digest..."
Today's Topics:

   1. Re: Has there ever been discussion around a python-like
      "with" syntax? (Michael J. Ryan)



---------- Forwarded message ----------
From: "Michael J. Ryan" <[hidden email]>
To: [hidden email]
Cc: [hidden email], es-discuss <[hidden email]>
Bcc: 
Date: Wed, 17 Oct 2018 13:19:17 -0700
Subject: Re: Has there ever been discussion around a python-like "with" syntax?
I was going to mention C#'s using statement as well... though I do like the use of a symbol over Ron's proposal, I think using might be a better approach.

-- 
Michael J. Ryan
<a href="tel:(480)%20270-4509" value="+14802704509" rel="noreferrer noreferrer" target="_blank">480-270-4509


On Mon, Oct 15, 2018 at 11:50 AM Till Schneidereit <[hidden email]> wrote:
Ron Buckton has a proposal that's quite similar to what you're talking about: https://github.com/tc39/proposal-using-statement

On Mon, Oct 15, 2018 at 11:40 AM Dan Aprahamian <[hidden email]> wrote:
Hello all! First time posting here. I was curious if there was ever talk about adding something similar to python's with syntax to JS. Obviously we already have a "with" keyword, but I figure we could probably use "use" as the keyword instead. I was thinking something like

// Some user defined resource that can be "entered" and "exited"
class MyResource {
  // Function called when entered
  async [Symbol.enter]() {
  }

  // Function called when exited
  [Symbol.exit]() {
  }
}

const resource = new MyResource();

async function useResource() {
  use myResource {
    // Inside here, resource has had "acquire" called on it

    await doSomethingAsync();
    // Once this block is finished executing (including async)
    // release is called
  }
  // Release has been called now
}

Use would effectively be the equivalent of:

async function use(resource, body) {
  await resource[Symbol.enter]();
  try {
    await body();
  } finally {
    await resource[Symbol.exit]();
  }
}

Has something like this been considered before?

Thanks,
Dan
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

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

Re: Has there ever been discussion around a python-like "with" syntax

Isiah Meadows-2
It's usually as simple as just reading it and filing issues/suggestions. IIRC there's a CONTRIBUTING.md in the repo that redirects to TC39's main document, and that could help you.
On Thu, Nov 8, 2018 at 10:35 Dan Aprahamian <[hidden email]> wrote:
Sorry for spamming, forgot to edit subject line.

Anyway, is there a good way to get involved with https://github.com/tc39/proposal-using-statement?

Thanks,
Dan

On Thu, Nov 8, 2018 at 10:21 AM Peter Jaszkowiak <[hidden email]> wrote:
> When replying, please edit your Subject line so it is more specific than "Re: Contents of es-discuss digest..."

I have no idea which proposal you're talking about.

On Thu, Nov 8, 2018, 08:18 Dan Aprahamian <[hidden email] wrote:
Is there a good way to get involved in the development of this proposal?

On Thu, Oct 18, 2018 at 8:01 AM <[hidden email]> wrote:
Send es-discuss mailing list submissions to
        [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
        https://mail.mozilla.org/listinfo/es-discuss
or, via email, send a message with subject or body 'help' to
        [hidden email]

You can reach the person managing the list at
        [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of es-discuss digest..."
Today's Topics:

   1. Re: Has there ever been discussion around a python-like
      "with" syntax? (Michael J. Ryan)



---------- Forwarded message ----------
From: "Michael J. Ryan" <[hidden email]>
To: [hidden email]
Cc: [hidden email], es-discuss <[hidden email]>
Bcc: 
Date: Wed, 17 Oct 2018 13:19:17 -0700
Subject: Re: Has there ever been discussion around a python-like "with" syntax?
I was going to mention C#'s using statement as well... though I do like the use of a symbol over Ron's proposal, I think using might be a better approach.

-- 
Michael J. Ryan
<a href="tel:(480)%20270-4509" value="+14802704509" rel="noreferrer noreferrer" target="_blank">480-270-4509


On Mon, Oct 15, 2018 at 11:50 AM Till Schneidereit <[hidden email]> wrote:
Ron Buckton has a proposal that's quite similar to what you're talking about: https://github.com/tc39/proposal-using-statement

On Mon, Oct 15, 2018 at 11:40 AM Dan Aprahamian <[hidden email]> wrote:
Hello all! First time posting here. I was curious if there was ever talk about adding something similar to python's with syntax to JS. Obviously we already have a "with" keyword, but I figure we could probably use "use" as the keyword instead. I was thinking something like

// Some user defined resource that can be "entered" and "exited"
class MyResource {
  // Function called when entered
  async [Symbol.enter]() {
  }

  // Function called when exited
  [Symbol.exit]() {
  }
}

const resource = new MyResource();

async function useResource() {
  use myResource {
    // Inside here, resource has had "acquire" called on it

    await doSomethingAsync();
    // Once this block is finished executing (including async)
    // release is called
  }
  // Release has been called now
}

Use would effectively be the equivalent of:

async function use(resource, body) {
  await resource[Symbol.enter]();
  try {
    await body();
  } finally {
    await resource[Symbol.exit]();
  }
}

Has something like this been considered before?

Thanks,
Dan
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss