A Function.tag proposal?

#!/JoePea joe at trusktr.io
Thu Sep 24 21:28:18 UTC 2020


By the way, the VS Code plugin I use is [Comment tagged
templates](https://marketplace.visualstudio.com/items?itemName=bierner.comment-tagged-templates).
Works great, allows any extension in the comment, and it will
highlight as long as you have that syntax installed separately.

I got tired of pasting my identity tag everywhere.

#!/JoePea

On Thu, Sep 24, 2020 at 2:25 PM #!/JoePea <joe at trusktr.io> wrote:
>
> I mean, it would be only a parse time cost if the identity tag is used like
>
> ```js
> String.tag`...anything...`
> ```
>
> assuming it is not monkey-patchable (readonly). But maybe if it is
> patchable then all bets are off, and it has a runtime cost.
>
> #!/JoePea
>
> On Thu, Sep 24, 2020 at 2:22 PM #!/JoePea <joe at trusktr.io> wrote:
> >
> > Perhaps a built-in identity tag would be only a parse-time performance cost.
> > #!/JoePea
> >
> > On Thu, Sep 24, 2020 at 2:21 PM #!/JoePea <joe at trusktr.io> wrote:
> > >
> > > I don't know what you mean about the raw stuff, but using `/*css*/`
> > > works perfectly fine in VS Code with a plugin. There's no reason
> > > intellisense can't work inside the commented string. If you meant
> > > about completing the `css` part, if you accidentally write `/*ccs*/`
> > > then the colors won't look right. Missing auto-completion inside the
> > > little comment isn't that bad.
> > >
> > > I prefer using the comment because using an identity tag just for
> > > syntax feels like I'm adding a performance cost for no reason related
> > > to my runtime code.
> > >
> > > But perhaps a built-in identity tag would be fast.
> > >
> > > #!/JoePea
> > >
> > > On Mon, Jun 22, 2020 at 11:02 AM Andrea Giammarchi
> > > <andrea.giammarchi at gmail.com> wrote:
> > > >
> > > > I think it doesn't matter where it lands, and I've overlooked at the already available String.raw.
> > > >
> > > > My idea is to have it "no matter where, or how named" as it's the functionality I am after, not the name.
> > > >
> > > > String.plain sounds great, but since template literals tag functions are named "template literals tag functions", I've thought String.tag would implicitly describe the intent.
> > > >
> > > > And then again, I don't care about the name, "we" (developers that use template literals a lot) would love it no matter how it's called ;-)
> > > >
> > > > On Mon, Jun 22, 2020 at 7:16 PM Bergi <a.d.bergi at web.de> wrote:
> > > >>
> > > >> Hi Andrea,
> > > >>
> > > >> my 5ct: Putting the static function on the `Function` object doesn't
> > > >> make any sense to me. Using `String.tag` seems like much more sensible
> > > >> choice. Or, how about `String.plain`, in contrast to `String.raw`?
> > > >>
> > > >> I can see the use case, altough I'd really prefer tooling to become more
> > > >> intelligent in that regard.
> > > >>
> > > >> best,
> > > >>  Bergi
> > > >> _______________________________________________
> > > >> es-discuss mailing list
> > > >> es-discuss at mozilla.org
> > > >> https://mail.mozilla.org/listinfo/es-discuss
> > > >
> > > > _______________________________________________
> > > > es-discuss mailing list
> > > > es-discuss at mozilla.org
> > > > https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list