00:00 | <pzuraq> | There were more frameworks and libraries that used metadata than not in our survey, IIRC |
00:00 | <shu> | let me put another way, if a burden is placed on all the libraries in the JS universe, that still seems okay |
00:00 | <shu> | vs, a burden put on a majority of all JS programmers |
00:01 | <pzuraq> | Fair enough, this would only be a burden on users of those specific frameworks and libraries |
00:01 | <bakkot> | my proposed sketch has a (slight) cost to anyone making use of such a library, to be clear, not just to the library itself |
00:01 | <shu> | good point, i'm trying to weigh that |
00:01 | <bakkot> | (it's actually arguably simpler for the library itself) |
00:01 | <shu> | the let GObject = makeGObject() thing? |
00:01 | <bakkot> | yup |
00:02 | <bakkot> | and the need to put a decorator on the class itself, in the case that need did not previously exist |
00:02 | <shu> | my experience, as someone whose day job is not using frameworks, to be clear, is that frameworks involve incantations already |
00:02 | <shu> | this could be a death-by-a-thousand-cuts thing, of course |
00:03 | <pzuraq> | Yeah, I wouldn’t think it’d be much of a burden either way tbh |
00:03 | <pzuraq> | For decorator authors |
00:03 | <shu> | i'm also not against a simpler metadata sketched solution |
00:03 | <shu> | v8's main dislike is the intricate hierarchy of the metadata object that's created |
00:05 | <shu> | perhaps Mathieu Hofman can sketch out what he meant by having an object |
00:05 | <Mathieu Hofman> | There's an old sketch here: https://github.com/tc39/proposal-decorators/issues/328 |
00:05 | <rbuckton> | i still think the answer to where parameter decorators fit in is that we do not have parameter decorators __param decorator on the method that essentially adapts it to a method decorator, so Metadata is still associated with the class |
00:07 | <rbuckton> | The way TS does parameter decorators today is it passes through a |
00:07 | <pzuraq> | Essentially the object handle version is to replicate the old semantics, where we received the class itself, as close as possible. So to do that, we pass in a target object to the decorator |
00:07 | <pzuraq> | And then we associate that with the class on Symbol.metadata |
00:08 | <pzuraq> | The object can be used as a WeakMap key to the decorator’s metadata |
00:08 | <shu> | rbuckton: i am not interested in the mechanics of it until we decide it's actually a good idea? |
00:08 | <pzuraq> | That’d be simplest possible API here, though it’s a bit odd |
00:09 | <pzuraq> | I would feel better about it if Symbols could be used as weakmap keys, and then we can just pass in a symbol, call it metadataKey |
00:09 | <pzuraq> | But a frozen object also works |
00:09 | <shu> | or rather, until fairly strong opposition to the mere idea of parameter decorators fade away, not necessarily we all decide it's a good idea |
00:10 | <rbuckton> | rbuckton: i am not interested in the mechanics of it until we decide it's actually a good idea? |
00:10 | <rbuckton> | VS Code is one of them |
00:11 | <bakkot> | "people use this feature in another language" is not very compelling, on its own? there's a lot of C programs doing raw pointer arithmetic but we sure aren't gonna add that to JS |
00:11 | <shu> | agree |
00:11 | <shu> | though i do want pointer arithmetic |
00:11 | <pzuraq> | VSCode is a TS project? |
00:12 | <bakkot> | That’d be simplest possible API here, though it’s a bit odd context , which is created per class definition, and which is passed to every decorator within the class. if a decorator wants to expose the metadata to the class, a class-level decorator add a symbol to the class which exposes the context object. |
00:12 | <rbuckton> | VSCode is a TS project? |
00:12 | <pzuraq> | Sorry, I meant in response to the assertion about other languages |
00:13 | <pzuraq> | Like, these are JS/TS examples |
00:13 | <Kris Kowal> | That’s something of an understatement, is it not, since TS and VS Code both originate in the same lab? |
00:13 | <pzuraq> | Unless I missed something |
00:13 | <rbuckton> | That’s something of an understatement, is it not, since TS and VS Code both originate in the same lab? |
00:13 | <Kris Kowal> | Ah. |
00:13 | <bakkot> | TS with decorators is a different language from JS |
00:14 | <bakkot> | since there's nontrivial runtime stuff going on |
00:14 | <pzuraq> | I think the simplest API for metadata is to have an associated object which lives on the |
00:15 | <shu> | we have pretty divergent personal understandings of "decent subset" i think |
00:15 | <bakkot> | I'm not sure what you mean by "invent their own sidechannels"? |
00:15 | <bakkot> | and the "excessive burden" is just the need to use a class-level decorator, I think? |
00:15 | <bakkot> | not even the GObject = makeGObject() bit, with that design |
00:16 | <shu> | i would be fine with the "stand-in associated object" design, at first blush |
00:18 | <pzuraq> | we have pretty divergent personal understandings of "decent subset" i think |
00:18 | <shu> | also, a meta-comment about using large projects as existence proofs for the desirability of a new feature. my opinion here is that if that feature is about new expressivity, i.e. making something impossible today possible, i then find that existence proof very compelling. if that feature is instead about ergonomics, then i don't find that existence proof very compelling |
00:18 | <shu> | there's of course a lot of nuance |
00:19 | <shu> | where some things are so difficult and so unergonomic it borders on impossible, like e.g. shipping ICU data to do localization |
00:19 | <pzuraq> | not even the |
00:19 | <pzuraq> | would be nice if you could somehow have that be part of the import statement. Maybe you could do it with top level await? |
00:19 | <shu> | well what kevin was saying the stand-in object design wouldn't even require that |
00:19 | <shu> | so there's no burden there |
00:20 | <pzuraq> | stand-in-object design? Did I miss that somewhere? |
00:21 | <shu> | that's what i'm calling this: |
00:21 | <shu> | I think the simplest API for metadata is to have an associated object which lives on the |
00:22 | <shu> | gotta run for today, see you all tomorrow |
00:22 | <bakkot> | that design is only a slight tweak from the design where the associated object is automatically placed on the class's Symbol.metadata field |
00:22 | <bakkot> | I am mostly just spitballing with that, to be clear |
00:22 | <pzuraq> | I'm sorry, I did the thing where I didn't read the whole thing before responding 🤦♂️ |
00:23 | <bakkot> | I guess I don't have a fundamental objection to the design where you automatically stick the associated object on Symbol.metadata |
00:23 | <bakkot> | that's roughly as simple, really |
00:24 | <bakkot> | and arguably better, if the associated object is frozen and so only usable as a weakmap key |
00:25 | <pzuraq> | I do think that would be better than GObject = makeGObject() , that's what I meant by inventing their own sidechannels |
00:25 | <bakkot> | (because weakmaps don't have the problem where decorators from different libraries might contend for the string-key space on the associated object) |
00:25 | <pzuraq> | same |
00:26 | <pzuraq> | that was always something that didn't sit completely right with me about the Symbol-key-based metadata design |
00:26 | <bakkot> | what was? |
00:27 | <pzuraq> | that symbols were used to key/associate metadata. It avoided the collision problem, but it just felt not as nice as using weakmaps |
00:27 | <pzuraq> | habits I guess, I use weakmaps a lot in framework/library dev |
00:27 | <bakkot> | ah |
00:28 | <bakkot> | I actually like symbols better personally |
00:29 | <bakkot> | but it does make it very strange that other decorators get to see your data by default |
00:29 | <bakkot> | like, that's just weird |
00:29 | <bakkot> | if you [a decorator author] are using metadata to coordinate with yourself, you are probably not also intending to create a public API, but you inherently are, by accident |
00:29 | <bakkot> | and you have to work hard to make it not-public |
00:30 | <Mathieu Hofman> | That was my problem with the current metadata approach, you had to jump through hoops to communicate with yourself privately |
00:31 | <bakkot> | sidebar: this is yet another place where the fact that class A extends B creates a prototype relation between A and B , not just A.prototype and B.prototype , is going to bite us |
00:32 | <bakkot> | because A[Symbol.metadata] gives you B's metadata, unless A overwrites it |
00:32 | <bakkot> | I guess if we create Symbol.metadata on every class, even those without decorators, that's not a problem |
00:33 | <pzuraq> | that's a feature IMO, you generally want metadata to be inherited |
00:33 | <pzuraq> | most metadata is applied to the instance, and you don't really care whether or not it was on a specific parent class |
00:33 | <rbuckton> | One of the benefits of Metadata is discoverability, as it helps with library interoperability. If you don't want the Metadata to be discoverable, you can create your own empty object key to store the Metadata for the class and use a WeakMap internally. |
00:33 | <bakkot> | pzuraq: even for static fields? |
00:34 | <rbuckton> | Which was something we discussed in the champion/stakeholder calls |
00:34 | <bakkot> | encapsulation should be the default, not opt-in |
00:34 | <bakkot> | if you want to create a public API, you should do that on purpose |
00:34 | <bakkot> | it shouldn't happen by accident |
00:35 | <rbuckton> | encapsulation should be the default, not opt-in |
00:35 | <bakkot> | sorry, I'm talking about two different things here |
00:36 | <bakkot> | the first is, communicating with yourself, which should be encapsulated by default |
00:36 | <bakkot> | the second is, how does inheritance work |
00:36 | <pzuraq> | pzuraq: even for static fields? |
00:36 | <bakkot> | for when you want it to be public |
00:36 | <pzuraq> | there are other use cases where you would still want it though |
00:36 | <pzuraq> | e.g. validation |
00:36 | <bakkot> | hm. |
00:37 | <bakkot> | I can see why you would want that, yeah |
00:39 | <bakkot> | with the frozen-associated-key-object design, the decorator author would have to remember to walk up the prototype chain to see if anything in the chain had WeakMap associated data |
00:39 | <bakkot> | but that is maybe not so bad |
00:39 | <bakkot> | and is not a cost to users of the decorator |
00:39 | <Mathieu Hofman> | What are the validation use cases where the validator piece wouldn't have access to the internal state of the decorator? |
00:39 | <pzuraq> | yes, that's something the current design tried to avoid |
00:39 | <pzuraq> | but that's where the complexity starts to come in 🙃 |
00:39 | <pzuraq> | inheritance is basically 90% of the complexity |
00:40 | <pzuraq> | crawling the prototype chain is something that framework authors though are familiar with in my experience |
00:40 | <bakkot> | I guess if the object is frozen you don't necessarily need it to be a prototype chain |
00:41 | <bakkot> | you can just have the key be like Object.freeze({ __proto__: null, parent: (the superclass's Symbol.metadata property ) }) |
00:41 | <bakkot> | not really any advantage in a prototype relation for frozen empty objects, really |
00:42 | <pzuraq> | hmmm, yes |
00:42 | <pzuraq> | could allow you to get parent metadata during decoration too |
00:44 | <pzuraq> | What are the validation use cases where the validator piece wouldn't have access to the internal state of the decorator? |
00:45 | <Mathieu Hofman> | Maybe I misunderstood, but it seemed above it was suggested that validation use cases benefit from public metadata, but I didn't see how |
00:45 | <Mathieu Hofman> | or maybe I mixed up 2 different things ? |
00:46 | <pzuraq> | a typical validation library looks like import { string, number, object, validate } from 'validator-lib' |
00:46 | <pzuraq> | you then apply the type decorators to a field or other element |
00:46 | <pzuraq> | and then call validate() later on on the object |
00:47 | <pzuraq> | without a way to get which decorators were applied to the object being validated, you can't really validate |
00:50 | <Mathieu Hofman> | well if @string , @number etc. receive a stand-in object for the thing being decorated, then the main issue is linking the thing being decorated to the stand-in object, which can be done by adding an explicit @validated decorator to the thing to be validated? |
00:51 | <Mathieu Hofman> | or as mentioned, automatically add that standin-object to the thing being decorated as a [Symbol.metadata] prop |
00:51 | <pzuraq> | correct, both of those solutions would work |
01:12 | <bakkot> | opened an issue to record the associated-object design: https://github.com/tc39/proposal-decorators/issues/457 |
01:12 | <rbuckton> | Metadata use cases: DI, plugin/extensibility, ORM, WSDL/ws*, REST discovery/routing, FFI/Marshaling (esp parameters), serialization control (binary, JSON, XML), validation/contracts, RTTI, debugging (watch/locals window control, stepping behavior), proxy/membrane permeability,... |
01:32 | <devsnek> | shu: what's the result example you're referring to here https://github.com/tc39/proposal-pattern-matching/issues/253 |
01:44 | <rbuckton> | Metadata use cases: @register approach, any more than one or two uses starts to seem wasteful, and I could definitely see overlap in an API that used REST routing and WS routing for the same endpoint and DI for composition. Then add debugging extensions (like "step over this function") and we're up to 4 "registers". It becomes unwieldy quickly |
01:45 | <bakkot> | I contend that a class which is making use of decorators from four different libraries is already unwieldy. |
01:45 | <rbuckton> | The alternative is duplicating code or 4 different adapters to the same code, which increases maintenance |
01:48 | <rbuckton> | It may be a rare occurrence to see more than two, but requiring entangled decorators makes things dramatically worse |
01:52 | <rbuckton> | Also, you essentially need to create an entangled decorator pair per class declaration, you can't rely on execution order to handle association. |
01:54 | <rbuckton> |
|
01:55 | <shu> | devsnek: the one from the slide deck: https://docs.google.com/presentation/d/1sJoXU1ysK6eZn04pjnQ-1z6EetsVf9VfHeU0Ht8hiFQ/edit#slide=id.g112a5d188b1_0_231 |
01:55 | <rbuckton> | So if you have more than one class per file you need multiple calls to makeMeta , which again can quickly become untenable |
01:57 | <bakkot> | "untenable" is, I think, not how I would describe that, but I agree that's what it would look like |
01:58 | <shu> | man we have pretty different definitions of "untenable", rbuckton |
02:08 | <devsnek> | ah i see |
02:08 | <devsnek> | yeah matches:bool is not fantastic |
02:11 | <devsnek> | it would be nice if there was a way to teach match syntax about custom discriminated unions |
02:12 | <rbuckton> | man we have pretty different definitions of "untenable", rbuckton I'd rather not have
|
02:12 | <devsnek> | i have a feeling a lot of custom matchers are actually just fancy discriminated unions |
02:13 | <rbuckton> | man we have pretty different definitions of "untenable", rbuckton |
02:14 | <devsnek> | class fields are already pretty nuts, this doesn't seem too much worse by comparison |
02:16 | <rbuckton> | Entangled decorators can work well in isolated cases (and I've used a similar approach in those cases), but the pattern does not extend well to a general practice. |
02:16 | <bakkot> | oh, we never addressed https://github.com/tc39/proposal-decorators/issues/417 :( |
02:17 | <bakkot> | I completely forgot about that one |
02:18 | <rbuckton> | IIRC, we chose isStatic over just static because static is a keyword and doesn't work well with destructuring. |
02:19 | <rbuckton> | That was several years ago when Yehuda was championing the proposal, though so there may be other context I'm unaware of. |
02:19 | <devsnek> | { static: isStatic } seems fine to me |
02:20 | <rbuckton> | But why force that on end users? |
02:20 | <rbuckton> | (by that I mean decorator authors) |
02:20 | <bakkot> | https://w3ctag.github.io/design-principles/#naming-booleans |
02:20 | <rbuckton> | I don't have a strong preference either way |
02:23 | <rbuckton> | I was under the impression switching fromstatic to isStatic was at the committee's request during an update several years ago. I'd have to dig through the meeting notes to be sure. |
02:25 | <pzuraq> | I also don’t have a strong preference |
02:26 | <bakkot> | if we have an extra five minutes this meeting I'd like to revisit that specific question, before anyone ships it |
02:28 | <bakkot> | I can't find either "isStatic" or "isPrivate" in the notes, but it's possible the notes didn't capture it (under those names) |
02:28 | <pzuraq> | Yeah sounds good, ideally we should address it now |
02:29 | <bakkot> | we have to address it now |
02:29 | <bakkot> | or wait to the next meeting |
02:29 | <bakkot> | normative changes can only happen by consensus at this point |
02:29 | <rbuckton> | This was several versions and several champions ago, so again I'm not 100% sure of the context |
02:29 | <devsnek> | i hope we just go with whatever the design principles say, sucks to have that kind of thing around and still debate it |
02:30 | <pzuraq> | I honestly think I may have just chosen the name based on what I thought made sense at the time, I didn’t have the context of the naming standards in the language |
02:30 | <pzuraq> | And the only reason we didn’t update was because, as others pointed out, these are keywords |
02:31 | <bakkot> | we do not always consider ourselves bound by the web platform's design principles, for better or worse. there are some rare cases where I think it makes sense to deviate (mainly where the language is doing something language-y), but this I think is not one of them. |
02:32 | <bakkot> | I suppose it's not a disaster if we have to wait 'till next meeting for that change; it's not like anyone's going to ship a feature of this size unflagged before then, and it's a small change in implementations |
02:32 | <bakkot> | still, would be real nice to address now |
02:32 | <pzuraq> | Yeah, sounds fine to me. If we can work it in let’s do it. I’m not available for the first part of tomorrow, but if you end up finding time to address then my position is “whatever the committee thinks is best” |
02:32 | <bakkot> | √ |
02:33 | <pzuraq> | And any other time I can hop on, though I may be in and out due to meetings |
02:34 | <rbuckton> | Ah, at one point it was placement: "static" |
02:35 | <bakkot> | you may have been thinking of https://github.com/tc39/proposal-decorators/issues/421, also |
02:35 | <devsnek> | placement: 'private-static' |
02:35 | <devsnek> | or maybe static-private 😉 |
02:35 | <rbuckton> | Please no, I don't want to have to parse strings |
02:35 | <devsnek> | implementation defined order |
02:36 | <rbuckton> | Because that list could grow |
02:36 | <bakkot> | placement: 'the abyss' |
02:37 | <devsnek> | placement: 'binary blob of a png of the source code with a red square around the declaration' |
02:37 | <rbuckton> | At least 6 years ago it was static: true , according to a gist I wrote to investigate type definitions for the decorator context object |
02:37 | <devsnek> | did es4 have decorators |
02:37 | <rbuckton> | Dated June 15, 2016 |
02:37 | <rbuckton> | Not that I recall |
03:31 | <Ashley Claymore> | My memory might be off, but at some point wasn’t there additional syntax for field decorators that wanted to also access the class? So there was a small, but local, opt-in cost to the extra complexity.
|
03:47 | <Ashley Claymore> | I was miss remembering @init for methods to add logic to the instance. |
12:42 | <pzuraq> | ok, the spec text and README for the proposal have been updated |
12:43 | <pzuraq> | so it should be ready for stage 3 with the agreed upon changes :D |
13:17 | <pzuraq> | Daniel Ehrenberg 👋 |
13:32 | <Justin Ridgewell> | Rob Palmer and Keepers of the Schedule: https://github.com/tc39/agendas/pull/1153 |
13:59 | <shu> | Rob Palmer: ^ see above for https://github.com/tc39/proposal-decorators/issues/417, is there a 5-15minute timeslot somewhere? |
14:00 | <bakkot> | bot's up |
14:01 | <yulia> | show time |
14:13 | <Michael Ficarra> | this proposal is less about memoisation and more about making procedures idempotent |
14:14 | <Michael Ficarra> | the memoisation-y parts are just because we have to do something about a return value |
14:17 | <Tierney Cyren> | I fail to see what the utility of returning undefined is. What would that actually be useful for? |
14:17 | <legendecas> | callbacks |
14:18 | <legendecas> | we don't expect return values from callbacks like eventemitter/eventlisteners |
14:19 | <ljharb> | virtually every use case i have for "once" is either as an async callback, where the return value doesn't matter, or where i'm trying to sync log a warning (like node does, for deprecation warnings) and i don't use the return value. |
14:19 | <Richard Gibson> | this capability doesn't seem to be common in other languages; I see https://doc.rust-lang.org/std/ops/trait.FnOnce.html in Rust but can't find an analog in Python, Ruby, or Go |
14:19 | <ljharb> | (iow node's own emitWarning thing would likely use this) |
14:19 | <Justin Ridgewell> | We've used the return value constantly |
14:20 | <Justin Ridgewell> | Eg, to guard creation of an expensive object |
14:20 | <bakkot> | that's a good example |
14:20 | <ljharb> | hm, that is a good example |
14:20 | <ljharb> | but that seems like a "memoize" helper not a "once" helper |
14:20 | <ljharb> | since you'd want it to vary based on input, esp to avoid the confusion waldemar talked about |
14:20 | <Michael Ficarra> | Justin Ridgewell: that's just a special case of a memoisation function with no arguments |
14:21 | <ljharb> | i think it'd be far better to solve those problems separately |
14:21 | <Justin Ridgewell> | Yes, but once is a mini memoization function as used in the ecosystem |
14:21 | <Richard Gibson> | and in general probably wouldn't want a "once" helper to encapsulate a strong reference |
14:22 | <Michael Ficarra> | then I guess I'm leaning toward caching the return value but ignoring passed arguments |
14:22 | <ptomato> | not in JS, but I've used "once" functions many times in C and C++ to initialize a static variable, which is morally equivalent to wanting a return value out of it |
14:22 | <Michael Ficarra> | the oddity waldemar brought up is compelling to me |
14:22 | <ljharb> | then I guess I'm leaning toward caching the return value but ignoring passed arguments |
14:22 | <Michael Ficarra> | ljharb: a little bit, yeah |
14:23 | <bakkot> | throwing if you pass it arguments, maybe |
14:23 | <ljharb> | oh unless you mean, never passing anything through the once function to the wrapped one? |
14:23 | <Justin Ridgewell> | I don't understand why we would break with precedent |
14:23 | <ljharb> | that seems totally fine to me, it's like () => (called ? () => {} : original)() |
14:23 | <Michael Ficarra> | bakkot: the reason I didn't say throwing is because you might pass it to a function you don't control which will call with arguments you don't want |
14:24 | <bakkot> | Michael Ficarra: in that scenario it would also break if you passed the raw (pre-once'd) version, no? |
14:24 | <ljharb> | I don't understand why we would break with precedent once caches its return value |
14:24 | <Michael Ficarra> | how? |
14:24 | <bakkot> |
|
14:24 | <bakkot> | oh, you just mean, your function ignores its arguments |
14:24 | <bakkot> | ok, yeah |
14:24 | <Michael Ficarra> | yes |
14:25 | <Justin Ridgewell> |
|
14:26 | <ljharb> | i hope you're not implying that people actually read documentation :-p |
14:26 | <ljharb> | i looked; the example code in both underscore and lodash only uses it for side effects, and that's what i bet people will notice |
14:34 | <rbuckton> | We use something like once for lazy-init in the TS code base quite often. In my own projects I just call it lazy (and it errors on circular init) |
14:36 | <ljharb> | i'm already sold on the use cases for memo + once . what i'm not on board with is conflating the two in a way which i think would be surprising to those not already aware of that behavior in the ecosystem. |
14:38 | <jschoi> | For what it’s worth, I am willing and plan to champion a configurable memoize (memo ?) helper function, based on the support for it I saw today. |
14:39 | <bakkot> | good luck |
14:39 | <bakkot> | lotta weird corners in that design space |
14:39 | <jschoi> | We’ll just min–max a MVP design. Nothing can go wrong… |
14:39 | <Michael Ficarra> | yeah, you might want to do some research on the designs of that function in underscore/lodash first |
14:39 | <rbuckton> | The problem with n-argument memo is that it has to hold the arguments for repeated calls. 0-arg memo is easier, but then it isn't really a memorize function |
14:39 | <Michael Ficarra> | those are some of the longest threads I've participated in |
14:40 | <jschoi> | those are some of the longest threads I've participated in |
14:41 | <jschoi> | I am filled with foreboding. |
14:41 | <jschoi> | The problem with n-argument memo would be a core use case of memo , I figure. |
14:42 | <Michael Ficarra> | yeah there's an inherent difficulty in anything that tries to make a universal definition of "equivalence" |
14:43 | <rbuckton> | 0-arg memo is just lazy (for lazy init). |
14:44 | <Michael Ficarra> | we already have at least 4 definitions in the spec as-is |
14:45 | <Michael Ficarra> | rbuckton: I don't know what this lazy function you're talking about is |
14:45 | <sarahghp> | 0-arg |
14:45 | <sarahghp> | 😀 |
14:45 | <jschoi> | But it would be a misnomer in the FP space. 0-argument memoize function and you can do ((memoize f)) if you want and it’s idiomatic. |
14:48 | <rbuckton> | By misnomer I mean that memoize in the FP space can accept functions that take n arguments, even if it's commonly only used with 0 argument functions. A memoize that only can take 0 argument functions isn't a true memoize. |
14:48 | <rbuckton> | So it could be confusing/frustrating. |
14:49 | <Michael Ficarra> | I don't think anyone has suggested that a hypothetical memoise function would only accept nullary functions |
14:49 | <jschoi> | Yes, memoize ’s functions definitely would not take only zero arguments. They could take zero arguments, but they could take many too. |
14:49 | <jschoi> | It falls out of what memoize is. Zero arguments is just a special case. |
14:50 | <rbuckton> | It's the N-ary version of memoize that gets complicated wrt GC |
14:51 | <rbuckton> | rbuckton: I don't know what this Lazy<T> (and F# has the concept of "lazy expressions" which evaluate to Lazy<T> ) |
14:51 | <Michael Ficarra> | okay but that does that mean? |
14:52 | <rbuckton> | It's a result whose value is lazy-initialized when it is requested. |
14:52 | <Michael Ficarra> | ... that's the same as T |
14:53 | <jschoi> | Incidentally, please direct-message links to any of those threads that you remember! (I’m finding https://github.com/lodash/lodash/issues/2115 and https://github.com/jashkenas/underscore/issues/1862.) |
14:55 | <rbuckton> | ... that's the same as Lazy<T> has a "value" property that evaluates the expression at most once when first requested. |
14:56 | <Michael Ficarra> | rbuckton: I guess I'm used to lazy-by-default and forcing strictness where necessary, instead of the other way around |
14:59 | <rbuckton> | I'm not sure what you mean by "lazy by default" in this case. |
15:04 | <Michael Ficarra> | rbuckton: imagine every T is instead a Lazy<T> , implicitly, everywhere |
15:06 | <rbuckton> | I'm not sure we're talking about the same things. |
15:07 | <jschoi> | rbuckton: Just to confirm, const lazyF = Function.memoize(expensiveF); lazyF(); lazyF(); works for the lazy use case, doesn’t it? |
15:08 | <rbuckton> | Yeah, it works just fine. |
15:10 | <ljharb> | so, PSA everybody: i'm organizing the github teams on the tc39 org. as a result, you may get notifications that you're added to a "Member: Something" team, and removed from the "Delegates" team - your "member" team will be a child team of Delegates, so no permissions should change. Please let me know if: a) you run into any github permission issues b) i've gotten your affiliation wrong c) you have multiple affiliations and i've forgotten some of them Thanks! |
15:14 | <rbuckton> | My only concern with memoize is that it's not a true memoize unless it can take functions that accept multiple arguments and only evaluates once "for each unique sequence of arguments", and that has GC implications. It's not a blocking concern, but may be a source of confusion for anyone coming from an FP language or library that does have a true "memoize" implementation. I'm wary of borrowing something from FP but have a implementation that doesn't match the FP version. |
15:16 | <rbuckton> | (and yes, TS has a function called memo internally that only supports 0-arg, and I wrote it, but it's internal only so 🤷) |
15:17 | <jschoi> | My only concern with |
15:19 | <bakkot> | python has lru_cache for this |
15:19 | <bakkot> | which I like a lot |
15:20 | <rbuckton> | Is the GC concern that memoized functions permanently cache their arguments? |
15:20 | <Michael Ficarra> | rbuckton: I think you can solve the GC issues by using a tree of WeakMaps for the argument storage |
15:20 | <bakkot> | only if the arguments are objects |
15:20 | <Michael Ficarra> | it'd be easier if we could shove anything into WeakMaps though... |
15:20 | <bakkot> | if the arguments are all primitive and the return value is not, now you have no gc |
15:21 | <Kris Kowal> | python has lru_cache for this |
15:21 | <Michael Ficarra> | bakkot: you know where I stand on that |
15:21 | <rbuckton> | rbuckton: I think you can solve the GC issues by using a tree of WeakMaps for the argument storage memoize for n-arg could be potentially difficult to standardize |
15:22 | <bakkot> | Michael Ficarra: I only know things after 9am |
15:22 | <bakkot> | so, remind me? |
15:22 | <Michael Ficarra> | https://github.com/tc39/proposal-symbols-as-weakmap-keys/issues/21#issuecomment-1016934180 |
15:26 | <danielrosenwasser> | That item on the queue for a stage between 3/4 for shipping flagged vs. unflagged is something I would be interested in discussing one of these days |
15:27 | <danielrosenwasser> | (hey, I'm not the one who opened the can of worms :D ) |
15:31 | <shu> | guess it depends on what that means |
15:31 | <Michael Ficarra> | I am often writing code that is trying to be defensive against a malicious Function.prototype.call exfiltrating my function, and yet I don't feel it's inconvenient to create a helper const call = Date.call.bind(Date.call); |
15:32 | <shu> | danielrosenwasser: i wouldn't find slowing down feature release cadence to be as slow as TC39's own schedule to be acceptable |
15:32 | <shu> | post stage 3, that is |
15:33 | <ptomato> | I'd guess that not all proposals would benefit from such a stage |
15:34 | <shu> | also big +1 |
15:34 | <shu> | if we codify an optional stage for proposals that need it |
15:34 | <shu> | that seems pretty good! details tbd ofc |
15:36 | <ljharb> | right, definitely only a subset of proposals |
15:36 | <ljharb> | i remind again of my "risk factors" process doc PR, one of which could be this :-p |
15:36 | <Rob Palmer> | if anyone has avenues to reach Pzuraq, please check if they can present Decorators sometime in the next 30mins (the overflow item) |
15:36 | <Rob Palmer> | I have tried Matrix and Twitter DM. |
15:38 | <bakkot> | Rob Palmer: they said last night they were not around this morning in particular but were OK with whatever the committee wants |
15:38 | <bakkot> | assuming this is the isPrivate thing |
15:39 | <bakkot> | I can present that issue, if pzuraq cannot be located in time |
15:39 | <bakkot> | https://matrixlogs.bakkot.com/TC39_Delegates/2022-03-29#L171 |
15:39 | <Rob Palmer> | we can always do it Thursday - there is no time pressure, (and maybe no time at all) if it's better for pzuraq |
15:40 | <Rob Palmer> | i say no time pressure - i mean, it fits, so long as NO ONE OVERRUNS |
15:40 | <shu> | pzuraqalso said he dosen't feel strongly and is comfortable with whatever consensus committee reaches |
15:40 | <shu> | would rather we don't risk not discussing this imo |
15:41 | <Kris Kowal> | I want to register, informally, that “call this” is a net negative for the precious understandability of the language. I do not think it’s useful to sweep “call” and “bind” under the syntax of the language. “call” and “apply” are perhaps warts, but they’re instructive warts. |
15:42 | <ljharb> | I want to register, informally, that “call this” is a net negative for the precious understandability of the language. I do not think it’s useful to sweep “call” and “bind” under the syntax of the language. “call” and “apply” are perhaps warts, but they’re instructive warts. |
15:42 | <yulia> | it is quite difficult to search syntax |
15:43 | <shu> | what if we shipped editor macro for every popular editor that expands ~. or whatever syntax the user chooses to .call |
15:43 | <ljharb> | sure, that's fair. but i believe most wouldn't need to search it, because it's pretty intuitive once you know about this |
15:43 | <shu> | also auto-converters for code viewers and searches i guess |
15:44 | <pzuraq> | Rob Palmer: shu As noted above, I’m ok with whatever consensus the committee reaches on the static/isStatic naming issue |
15:45 | <pzuraq> | You can discuss without me, I’m not available until 1:30pm ET |
15:45 | <Rob Palmer> | pzuraq: thank you. we will do it in the first spare time we have. |
15:45 | <Rob Palmer> | shu: i think it will fit in this meeting. we have some time profit. |
15:45 | <Kris Kowal> | I also have some hope that we will reserve ~ (tilde) for eventual send, since it has the obvious in retrospect “stream” mnemonic. |
15:47 | <Kris Kowal> | can you elaborate on that? my belief is the opposite, that it increases understandability this binding and does not replace having to understand .call , .apply , and .bind . |
15:48 | <Rob Palmer> | All, if you get a mail saying Jordan has removed you as a member of TC39 Delegates on Github, fear not, you are still part of the Delegates team. Jordan is creating Github sub-teams per-member to help us track membership better. |
15:48 | <shu> | thought i was free |
15:48 | <Kris Kowal> | So, as a reader of the language, you need to know more, not less, and call and apply are a more searchable teaching moment, to Yulia’s point. |
15:49 | <Rob Palmer> | thought i was free |
15:50 | <yulia> | yes, this is more of an expert feature. We have done similar moves with => . There is something wrong, users struggle with .bind and .call. It's more about ambiguity around this than word order though (so, i disagree with the thesis). I do think there is something to fix but i don't know how, and this might do it? |
15:52 | <Kris Kowal> | I’m personally happy with arrow functions, but anecdotally, I’ve been told by people who assume me a JavaScript partisan, that arrow functions marked the moment JavaScript ceased to be friendly to newcomers. |
15:53 | <yulia> | like the case i keep thinking about is obj.method.{call,bind}(obj, val) -- this is a bit weird |
15:53 | <yulia> | im not so concerned about obj.method.{call,bind}(anotherObj,val) that seems valid. |
15:54 | <ljharb> | my more common use cases are const method = obj.method; /* much much later */ method.call(otherObj) /* vs */ otherObj~>method() |
15:54 | <yulia> | it feels like that isn't so bad |
15:54 | <Rick Waldron> | "bitwise XOR is not very common" |
15:55 | <ljharb> | it feels like that isn't so bad |
15:55 | <Mathieu Hofman> | like the case i keep thinking about is apply before spread |
15:55 | <Michael Ficarra> | Rick Waldron: yes I'm sure there are entire programs that are nothing but xor, but that's not representative of the majority |
15:55 | <bakkot> | my more common use cases are |
15:55 | <bakkot> | used to be a lot more common before spread, because you had to work with arguments objects |
15:55 | <yulia> | when does one need to write this. It used to be the case with |
15:55 | <bakkot> | but now? not really ever. |
15:56 | <ljharb> | yes, i agree, but "code which is being defensive" is quite common for me |
15:56 | <bakkot> | well |
15:56 | <bakkot> | mm |
15:56 | <ljharb> | and for node core |
15:56 | <bakkot> | I do not think "this code is common for jordan, in particular", is a good reason to syntax to the language |
15:56 | <ljharb> | and thus it's important for all the users of all that code, at a minimum |
15:56 | <Michael Ficarra> | ljharb: same, but we can be expected to go through the minor inconvenience of saving off a call-bound call |
15:56 | <ljharb> | i totally agree that no one person's needs should justify addition of anything |
15:57 | <ljharb> | but in node core, in particular, this syntax would (mostly) resolve a long-standing debate about the tradeoffs of readability vs robustness |
15:57 | <Michael Ficarra> | ljharb: how is that even a debate in node core? |
15:57 | <shu> | that seems like a node core problem to me... |
15:57 | <ljharb> | Michael Ficarra: good question, yet it is |
15:58 | <ljharb> | the debate itself is a node core problem |
15:58 | <ljharb> | but the readability harm of the status quo, that call syntax would address, is a general problem - just not a universal one |
15:58 | <Rick Waldron> | Rick Waldron: yes I'm sure there are entire programs that are nothing but xor, but that's not representative of the majority |
15:58 | <yulia> | ooo remapping, can we use apl syntax :D |
15:58 | <yulia> | can we just... introduce apl actually |
15:59 | <yulia> | i have 2 days. shit why didn't i add this to the agenda |
16:00 | <shu> | jschoi: please give folks on the queue a chance to speak for themselves unless the item says no need to speak |
16:01 | <jschoi> | shu: Will do, sorry. |
16:01 | <bakkot> | but the readability harm of the status quo, that call syntax would address, is a general problem - just not a universal one |
16:01 | <bakkot> | "cases where node is using .call " does not meet either bar, being neither very common nor effectively impossible |
16:02 | <ljharb> | sure, fair |
16:05 | <ljharb> | https://github.com/tc39/process-document/pull/35 |
16:06 | <jschoi> | bakkot: I might have missed it earlier, but were you still going to bring up decorators and .static vs. .isStatic ? |
16:06 | <bakkot> | yes |
16:07 | <bakkot> | whenever we have time to put it in |
16:07 | <Tierney Cyren> | Rob Palmer: fwiw you're still not muted despite it showing you muted |
16:07 | <Tierney Cyren> | seems like you've fixed it :P |
16:07 | <Rob Palmer> | errr.... |
16:08 | <Rob Palmer> | the fragility of software mute... |
16:08 | <Kris Kowal> | i have 2 days. shit why didn't i add this to the agenda |
16:08 | <yulia> | i have a friend who wants to introduce an emoji combinatorics proposal for tc39 |
16:09 | <Kris Kowal> | fn📢method |
16:09 | <jschoi> | APL needs an EMOJI reboot. |
16:09 | <Michael Ficarra> | jschoi: just use variation selector 16 |
16:10 | <Michael Ficarra> | ... why do I know about VS16 |
16:10 | <jschoi> | Yes, but they still don’t have the Emoji property! Imagine…opening your emoji picker and seeing your old APL friends in cartoony, colorful emoji glory. |
16:11 | <Kris Kowal> | ... why do I know about VS16 |
16:12 | <jschoi> | I have been careful not to mention stuff like Node core with call-this—in the end, it’s about the fact that .call is one of the most common operations in the language (cf. the corpus analysis), and common × clunky → worth optimizing. |
16:12 | <ryzokuken> | fn📢method |
16:16 | <Kris Kowal> | I have been careful not to mention stuff like Node core with call-this—in the end, it’s about the fact that |
16:17 | <Kris Kowal> | And when every objective argument runs to ground, there’s still a value judgement to be made. |
16:18 | <Kris Kowal> | I think I could be swayed by an argument of the form “this obviates the need for uncurryThis”, but I don’t have the spoons to make that argument. |
16:19 | <Kris Kowal> | As for syntax, there’s also a very high opportunity cost. |
16:20 | <jschoi> | Yeah, it’s true, we do have to consider cost. I wonder if there are truly any significant concrete costs to call-this—enough to come close to outweighing the improvement in common × clunky. |
16:21 | <Kris Kowal> | e.g., https://github.com/tc39/proposal-eventual-send#completing-the-proxy-analogy proposes some uses of tilde that would establish a precedent for tilde indicating an async operator. |
16:22 | <Kris Kowal> | There’s also the matter that common is not necessarily bad. |
16:24 | <jschoi> | Yeah, commonality is just a multiplier. In this case we’re multiplying the commonality by something that is bad (the clunkiness of .call ).As for eventual-send syntax, we certainly can try to be careful to bikeshed both proposals to not conceptually conflict with each other. It’s true that introducing new syntax makes it slightly harder to introduce newer syntax in the future. |
16:24 | <Kris Kowal> | But, this is an olive branch 🕊, I’m already strongly in support of eliminating uncurryThis. |
16:25 | <jschoi> | I am rooting for eventual send. Even if reading about E and Cap’n Proto still stretches my brain. |
16:25 | <Kris Kowal> | I could be convinced that syntax is a good solution to uncurryThis even if its usage is limited to Node.js core development. |
16:26 | <Kris Kowal> | Did you know Q had eventual send support? :-) |
16:27 | <jschoi> | I could be convinced that syntax is a good solution to uncurryThis even if its usage is limited to Node.js core development. |
16:55 | <Luca Casonato> | I won't be able to do note taking for the upcoming 2 hour block, so it'd be great if someone else could help out there. |
16:55 | <Ashley Claymore> | thanks for all your help so far Luca Casonato ! |
16:56 | <Rob Palmer> | thanks, Luca |
16:56 | <Rob Palmer> | Yulia will be chairing Types as Comments today. I'll be recusing as chair because I'm invested in the proposal. I will also try to convey this through the medium of light. A blue background means I'm on types. Yellow means I'm on chairing. |
17:01 | <bakkot> | I can do some notetaking but I'm nodding off occasionally, so will need at least one other person |
17:08 | <nicolo-ribaudo> | I can help with notes for a while |
17:15 | <rkirsling> | what the hell |
17:15 | <rkirsling> |
|
17:15 | <ljharb> | rkirsling: https://matrix.to/#/!WgJwmjBNZEXhJnXHXw:matrix.org/$qaDYVljoQO2iG0kW3fltpvxxLyKK4oi51kViN-FVWNY?via=matrix.org&via=mozilla.org&via=igalia.com |
17:16 | <rkirsling> | ah cool |
17:16 | <Luca Casonato> | All, if you get a mail saying Jordan has removed you as a member of TC39 Delegates on Github, fear not, you are still part of the Delegates team. Jordan is creating Github sub-teams per-member to help us track membership better. (from Rob Palmer further up) |
17:16 | <ljharb> | rkirsling: also, check your DMs |
17:17 | <rkirsling> | thanks 🙇 |
17:18 | <rkirsling> | should've also noticed the Admin-and-Business notifications, whoops |
17:18 | <ljharb> | np, it's a scary warning from github :-( sadly they don't notice that removal from the delegates team while leaving you on a child team of delegates is a noop (in this case. in the general case, it might not be, so i understand this choice) |
17:19 | <rkirsling> | oh weird |
17:26 | <Tierney Cyren> | All, if you get a mail saying Jordan has removed you as a member of TC39 Delegates on Github, fear not, you are still part of the Delegates team. Jordan is creating Github sub-teams per-member to help us track membership better. (from Rob Palmer further up) |
17:29 | <ljharb> | lol |
17:30 | <ljharb> | i wish i could include an explanatory message in that notification |
17:31 | <bakkot> | sorry sorry I just restarted it |
17:31 | <bakkot> | but yes we probably don't need to capture this part |
17:35 | <bakkot> | wish these slides did not use the maximally verbose form of comments here |
17:35 | <bakkot> | it feels like a strawman |
17:36 | <shu> | can you show the normal, terser form? |
17:38 | <bakkot> | flow's are the concise version which exists today, but you could also imagine plenty of other forms, e.g.
|
17:39 | <shu> | cool, thanks |
17:39 | <bakkot> | the closest thing they had to that was
or something like that |
17:39 | <Robin Ricard> | note that this form is not available in typescript |
17:39 | <bakkot> | isn't, but could be |
17:39 | <shu> | well, that's TS's decision |
17:39 | <Robin Ricard> | yea the second example ts can do today |
17:40 | <Robin Ricard> | yea that is true, just clarifying |
17:41 | <Michael Ficarra> | are we just trying to make it so people can run their code without first running a program that strips the signatures? |
17:41 | <Michael Ficarra> | that program would complete nearly instantly |
17:42 | <bakkot> | that is the thing we are trying to do, yes |
17:42 | <Michael Ficarra> | the only value I can see in this proposal is formalising some comment attachment rules |
17:42 | <Robin Ricard> | the goal is not just to strip ts to be clear, it is mostly to reserve syntax space for a new kind of comments |
17:43 | <Robin Ricard> | this would happen to match types |
17:43 | <Michael Ficarra> | Robin Ricard: the syntax space is already reserved though? |
17:43 | <Michael Ficarra> | also we can do that without making it a valid program |
17:44 | <bakkot> | well, : is reserved, interface just isn't used yet |
17:44 | <Robin Ricard> | Robin Ricard: the syntax space is already reserved though? : something ? |
17:44 | <Michael Ficarra> | Robin Ricard: yep |
17:44 | <HE Shi-Jun> | Many things need to be reserved, for example, class elements modifiers. |
17:45 | <nicolo-ribaudo> | I have to go in 10 mins, we will need another note taker |
17:45 | <bakkot> | (my agenda item is going to say "what if we just reserve ': followed by anything with balanced-brackets' in a few spots") |
17:45 | <bakkot> | nicolo-ribaudo: I'll pick it up again |
17:45 | <Robin Ricard> | there is still a difference between reserving and tolerating it |
17:45 | <yulia> | should i request more note takers? |
17:46 | <nicolo-ribaudo> | should i request more note takers? |
17:46 | <HE Shi-Jun> | there is still a difference between reserving and tolerating it |
17:46 | <Michael Ficarra> | Robin Ricard: yeah and again, the value of allowing it is just that you don't have to run some incredibly simple annotation stripper? |
17:46 | <Robin Ricard> | reserving means the engine will syntaxerror |
17:47 | <HE Shi-Jun> | reserving means the engine will syntaxerror |
17:47 | <Robin Ricard> | ok I have a dumb example |
17:47 | <Robin Ricard> | I need to test out some code in a repl |
17:47 | <Robin Ricard> | I need to copy, run the typestripper and then paste in my inspector |
17:47 | <Luca Casonato> | Robin Ricard: yeah and again, the value of allowing it is just that you don't have to run some incredibly simple annotation stripper? |
17:47 | <Michael Ficarra> | shu: I love your TCQ topic |
17:48 | <Robin Ricard> | for instance, with deno, I can just throw it in the repl |
17:48 | <shu> | are you reading a value judgment into it Michael Ficarra ? |
17:48 | <Michael Ficarra> | Luca Casonato: can you back that up somehow? |
17:48 | <ljharb> | for instance, with deno, I can just throw it in the repl npx ts-node |
17:48 | <Robin Ricard> | which is ok, I would like to do it in my browser if possible |
17:49 | <bakkot> | browser console could do this if it wanted |
17:49 | <Robin Ricard> | I might be narrowing the motivation here, it is just an example |
17:49 | <bakkot> | it already allows you to write { [x]: foo() } which is not valid JS (on its own) |
17:49 | <yulia> | I will organize the queue according to topic, FYI |
17:49 | <Luca Casonato> | Luca Casonato: can you back that up somehow? |
17:49 | <yulia> | Please make it clear what specifically your topic is about, first set will be around syntax |
17:50 | <Michael Ficarra> | Luca Casonato: a node REPL wrapper like ts-node can also make it just as easy to do |
17:51 | <yulia> | Next round is on the goal |
17:51 | <Luca Casonato> | You can see with the proliferation of tooling like esbuild and swc that folks want to make the "inner loop" much faster. The amount of investment in the space shows that this is a real problem that many people run into. I think that alone should qualify the topic as something we should consider in some form. |
17:52 | <bakkot> | biiiiig difference between a .1s tool and a 20s tool |
17:52 | <Michael Ficarra> | Luca Casonato: if this "inner loop" is build time, I am sure that just stripping types will not take long |
17:52 | <bakkot> | which is my experience of esbuild vs webpack or whatever |
17:52 | <yulia> | Also, reminder -- this is going for stage 1: we want to answer "is this problem space worth exploring" |
17:52 | <Mathieu Hofman> | Luca Casonato: a node REPL wrapper like |
17:52 | <bakkot> | not so obvious there is similar big difference between no tool and .1s tool |
17:52 | <Robin Ricard> | it's also your own dx when starting a new project |
17:52 | <Josh Blaney> | which is my experience of esbuild vs webpack or whatever |
17:52 | <Robin Ricard> | I actually make use a lot of the comments syntax for that reason, I just don't want to set up any tooling |
17:53 | <Luca Casonato> | Michael Ficarra: It's not just time, it's also project complexity. Many smaller projects that currently have build steps would not require any build steps if types would not have to be stripped. |
17:53 | <Robin Ricard> | comments are just very clunky as my project grows |
17:54 | <Robin Ricard> | I admit the flow syntax from earlier is looking good still |
17:55 | <bakkot> | 14 items on the queue, that might be a record |
17:55 | <Michael Ficarra> | I still think the only problem shown here is a need to associate comments with particular portions of the program |
17:55 | <bakkot> | that is not even shown here |
17:55 | <Tierney Cyren> | on-brand for types: lots of context for the same output :P |
17:55 | <bakkot> | different tools can have different rules, that's fine |
17:55 | <Michael Ficarra> | bakkot: you have to read between the lines |
17:56 | <nicolo-ribaudo> | waldemarIf you want a specific exaple for one of your topics, `a ? (b): c => (d): e => f` is fully ambiguous (it has two possible parser results) |
17:57 | <nicolo-ribaudo> | waldemarIf you want a specific exaple for one of your topics, `a ? (b): c => (d): e => f` is fully ambiguous (it has two possible parser results) |
18:01 | <jschoi> | Each person with concerns each should all try to be clear if they are blocking Stage 1. |
18:02 | <Michael Ficarra> | jschoi: "blocking stage 1" is more likely to be "unconvinced that a problem worth solving has been clearly identified" |
18:03 | <Michael Ficarra> | "blocking" is usually a thing that happens when a particular design decision has been made that is unacceptable, but pre-stage-1 proposals have nothing like that set in stone |
18:05 | <yulia> | HE Shi-Jun: since the types are ignored, we don't really need a type definition -- that can be done in comments |
18:05 | <yulia> | for example, as an iterative approach |
18:05 | <nicolo-ribaudo> | I have to go in 10 mins, we will need another note taker |
18:05 | <yulia> | should i pause and ask? |
18:05 | <ptomato> | Each person with concerns each should all try to be clear if they are blocking Stage 1. |
18:05 | <yulia> | do we have anyone? |
18:05 | <nicolo-ribaudo> | There is a single person |
18:05 | <bakkot> | so, my point is that : is already the main way you use types |
18:05 | <ptomato> | and incentivises paying more attention to people who claim that they will block stage 1 |
18:05 | <Pieter Ouwerkerk> | I can help with notes |
18:05 | <Robin Ricard> | the motivation to me targets 2 populations:
for end users:
tooling developers:
|
18:05 | <bakkot> | function (a: number, b: number): number {} would be legal with my proposal |
18:06 | <nicolo-ribaudo> | Thanks yulia! |
18:06 | <bakkot> | it's only the interface {} stuff which would not |
18:06 | <jschoi> | and incentivises paying more attention to people who claim that they will block stage 1 |
18:06 | <bakkot> | you'd have to write :interface {} or something |
18:06 | <ljharb> | This is reasonable. It makes me wonder what the purpose of discussion before Stage 1 ought to be, then. |
18:07 | <jschoi> | it's "is this actually a problem space we want to spend more committee time on" |
18:08 | <ljharb> | yes, we should and often do |
18:08 | <ljharb> | this proposal's a bit tricky tho since it's got a pretty large and fleshed out solution space |
18:09 | <Michael Ficarra> | we should definitely discourage bikeshedding before stage 1 |
18:09 | <Michael Ficarra> | we often fall into the trap of pre-stage-1 bikeshedding when the proposal contains an example solution that is unnecessarily fleshed out |
18:09 | <bakkot> | this proposal sure does have a lot of flesh in |
18:09 | <Luca Casonato> | I agree, these syntax questions are really not that important yet |
18:10 | <Michael Ficarra> | yes, sometimes that is necessary, but most of the time it is not |
18:10 | <TabAtkins> | I'm strong on bakkot's side here, of keeping this much more generic rather than including all these grammars. For example, I'm actively hampered regularly by Python's type annotations being meaningless-but-interpreted, because it tries to resolve names at runtime and affects how I have to write the rest of my code. The more uninterpreted we can make this, the better. |
18:11 | <bakkot> | re: wanting a more pleasant syntax than jsdoc: just make ts accept more pleasant comment syntax than jsdoc |
18:11 | <bakkot> | jsdoc is awful |
18:11 | <bakkot> | //: (number, number) => number would be fine |
18:12 | <TabAtkins> | "doctor, it hurts when i copy Java" |
18:12 | <shu> | see: date |
18:12 | <Michael Ficarra> | bakkot: Number -> Number -> Number please |
18:12 | <shu> | no |
18:12 | <shu> | no no nono |
18:12 | <Tierney Cyren> | to what Rob said, I'd really like to never have to use TypeScript and just get shouted at by ESLint when my code doesn't match my type comments |
18:12 | <jschoi> | Curried functions strike back… |
18:12 | <Robin Ricard> | A clearly defined generic carve out based on : would be very good progress I think |
18:13 | <TabAtkins> | Michael Ficarra: even haskell lets you write it either way, we can be a bit forgiving ^_^ |
18:13 | <Michael Ficarra> | before you all murder me, it was a joke! |
18:13 | <yulia> | |
18:13 | <bakkot> | Michael Ficarra: that's a different thing |
18:13 | <bakkot> | we have x => y => z and (x, y) => z |
18:13 | <yulia> | like : (number, number) => numer maybe that would help? |
18:13 | <bakkot> | gotta be able to type both |
18:14 | <Michael Ficarra> | yes yes I know |
18:14 | <bakkot> | yulia: yeah that was my concrete proposal for new syntax |
18:14 | <bakkot> | that we say : is a new comment form |
18:14 | <shu> | look for my next proposal, removing higher-order functions |
18:14 | <yulia> | ooh yes yeah that sounds kind of cool |
18:14 | <bakkot> | and would allow, e.g., an identifier or a paren-balanced thing after it |
18:14 | <Tierney Cyren> | I'm sad that's the perception because the way I read the minisite was that it was trying to specifically provide a root tool that can be used by Flow, TypeScript, and other types tools. |
18:14 | <jschoi> | that we say |
18:14 | <TabAtkins> | DEF STATEMENT IS_SHU_SERIOUS(INT TIMES_SHU_SHITPOSTED_TODAY_SO_FAR) { RETURN TRUE } |
18:15 | <Michael Ficarra> | TabAtkins: better make it a bigint, just to be safe |
18:15 | <yulia> | -> go to TDZ |
18:16 | <Michael Ficarra> | apologies yulia |
18:18 | <TabAtkins> | Back to serious: yeah I'm 100% for being able to drop in more comment syntaxes that let us comment-annotate at a fairly tight granularity (functions, args, etc), with only the minimum amount of grammar restriction to ensure they're parseable. |
18:18 | <ptomato> | need to step away from note taking for like 2 minutes |
18:19 | <TabAtkins> | So we can do the "build script, but also runnable immediately" thing that was mentioned by one of the presenters. |
18:20 | <jschoi> | Back to serious: yeah I'm 100% for being able to drop in more comment syntaxes that let us comment-annotate at a fairly tight granularity (functions, args, etc), with only the minimum amount of grammar restriction to ensure they're parseable. |
18:20 | <TabAtkins> | yes, god yes, that's really bad unless your language is designed up-front to have scoping/importing rules that are designed to mesh well with types |
18:21 | <TabAtkins> | like, Python's treatment of circular imports makes it godawful for this. mypy has a terrible hack around this (it sets a TYPE_CHECKING global, wherein you can import things that would cause a circular import error if done at runtime) |
18:22 | <TabAtkins> | Rust works good as far as I understand, for instance, and was designed from the get-go for it. |
18:22 | <yulia> | any objections to me moving this forward? |
18:22 | <Michael Ficarra> | I think it's still productive |
18:22 | <Michael Ficarra> | I especially appreciate hearing from Flow devs on this |
18:23 | <Josh Blaney> | am I missing something, I feel like this boils down to adding new ways to add comments , since most of this will be handled by IDE's, and it was said that these are handled as comments? |
18:23 | <Jack Works> | any objections to me moving this forward? |
18:23 | <bakkot> | if you want not to focus on the syntax, don't propose a bunch of syntax |
18:24 | <Robin Ricard> | bakkot: as daniel said, the syntax has been written by an enthusiastic community member, the champions are in favor of discussing syntax |
18:25 | <bakkot> | yeah but |
18:25 | <bakkot> | don't merge it, if you don't want to talk about it |
18:25 | <Robin Ricard> | yes it is maybe clumsy |
18:25 | <yulia> | jschoi: is your topic about typecheckers outreach covered? |
18:26 | <jschoi> | jschoi: is your topic about outreach covered? |
18:26 | <Robin Ricard> | I think the repo does not come from ts people |
18:26 | <Robin Ricard> | originally |
18:26 | <shu> | Jack Works: i didn't quite understand the malicious misleading comment. surely malicious actors can do that today in many devious ways |
18:26 | <jschoi> | Incidentally, I think the champions should consider adopting a GitHub Action that throttles new comments, like how the pipe-operator repository uses https://github.com/js-choi/github-comment-floodgate. I could not keep up with its comment traffic and had to unsubscribe. |
18:26 | <shu> | in a worse way, arguably, with actual program logic |
18:27 | <gkz> | bakkot: as daniel said, the syntax has been written by an enthusiastic community member, the champions are in favor of discussing syntax |
18:27 | <Robin Ricard> | sure, then sorry about the confusion |
18:28 | <Robin Ricard> | I thought it was from gil |
18:29 | <Robin Ricard> | having been in the community meetings it did not seem they wanted to impose a syntax today |
18:30 | <Robin Ricard> | just the idea, as all stage 0 proposals should be |
18:33 | <yulia> | aren't those hints basically guards shu ? |
18:34 | <Michael Ficarra> | yulia: all sorts of tools rely on comment attachment: linters, templating tools, etc |
18:34 | <shu> | yulia: no, not guards, actually hints |
18:34 | <yulia> | i see |
18:34 | <shu> | imagine UNLIKELY_BRANCH() |
18:34 | <shu> | stuff like that |
18:34 | <shu> | or : this is hot |
18:34 | <yulia> | oh i see |
18:37 | <bakkot> | wrote up the colon thing in a little more detail: https://github.com/giltayar/proposal-types-as-comments/issues/127 |
18:38 | <Luca Casonato> | Jack Works: I think shu meant that for the hint guided optimization, the comment space would be used for a different syntax (think asm.js), not regular TS / flow syntax |
18:39 | <shu> | yes, completely separate from the current types usage |
18:39 | <shu> | imagine each expression getting a 0-1.0 weight of hotness determined by some profiling, etc |
18:39 | <Robin Ricard> | wrote up the colon thing in a little more detail: https://github.com/giltayar/proposal-types-as-comments/issues/127 |
18:40 | <bakkot> | " a colon followed by an identifier, possibly with a following no-lineterminator-separated balanced-braces block" |
18:40 | <Robin Ricard> | all braces right? |
18:40 | <bakkot> | yeah |
18:40 | <bakkot> | or, for some definition thereof |
18:41 | <pzuraq> | I imagine Svelte and other languages that want to extend/modify the language in interesting ways wouldn't mind that proposal 🤔 |
18:41 | <Tierney Cyren> | again, very much looking forward to not having to use TypeScript for types and just get free type checking from ESLint :P |
18:41 | <Robin Ricard> | yes exactly that is a huge use case for this (replying to pzuraq ) |
18:41 | <bakkot> | probably not quotey brackets |
18:41 | <yulia> | reorged the queue to allow support statements at the end |
18:42 | <yulia> | and all topics to be covered before |
18:42 | <yulia> | we have 18 minutes, so please add your items to the queue so that any new topics can be covered before the end of the time box |
18:42 | <Tierney Cyren> | I imagine Node.js could also have "validate types" as a runtime option and eject if types fail, again without TypeScript or Flow or whatever the next cool types tooling is. |
18:42 | <pzuraq> | Robin Ricard: specifically bakkot 's proposal, with leading : on statements |
18:43 | <pzuraq> | looks a lot like the way they use labels |
18:43 | <Jack Works> | Jack Works: i didn't quite understand the malicious misleading comment. surely malicious actors can do that today in many devious ways |
18:43 | <Robin Ricard> | I did mean in general but bakkot 's idea achaieves that goal |
18:43 | <Luca Casonato> | I imagine Node.js could also have "validate types" as a runtime option and eject if types fail, again without TypeScript or Flow or whatever the next cool types tooling is. |
18:43 | <Michael Ficarra> | I still feel like this proposal is "what could we do with different types of more granular comments?" which is an interesting question but just doesn't qualify as a problem statement for stage 1 |
18:43 | <bakkot> | the problem to be solved is "I want to write type annotations and not strip them before running code on a real engine" |
18:44 | <bakkot> | you have a different problem in mind than the champions |
18:44 | <bakkot> | but they've been fairly clear about what the problem they're interested in is |
18:44 | <shu> | yes, i think the replies to my question made that clear that the thing i noticed is really an unintended consequence |
18:44 | <Michael Ficarra> | their response to Shu was "yeah maybe we could do that too" |
18:44 | <Tierney Cyren> | This would require standardizing the type system itself though, wouldn't it? |
18:44 | <Robin Ricard> | the problem to be solved is "I want to write type annotations and not strip them before running code on a real engine" |
18:44 | <Luca Casonato> | Would it? Given the most basic definition in this specification, if Node.js parsed the comments and validated them, I don't know if it would. I could absolutely be wrong, though. |
18:45 | <Michael Ficarra> | also I'd like to understand WHY they want to write the types inline, if they have no effect, and they're not fully compatible with TypeScript types |
18:46 | <Tierney Cyren> | I guess it depends on what "validate" means. Does validate == type check? |
18:46 | <Luca Casonato> | "eject on mismatch between reality and type comment" is what I mean and also could probably be defined as type checking |
18:47 | <Tierney Cyren> | Ok, I don't think that would be possible with the current scope of the proposal. |
18:47 | <Michael Ficarra> | yulia: before we ask for stage 1 advancement, I'd like the champions to explicitly restate the problem that we've identified |
18:47 | <yulia> | I will raise it before we go to stage advancement discussion |
18:47 | <Michael Ficarra> | thank you |
18:48 | <bakkot> | also I'd like to understand WHY they want to write the types inline, if they have no effect, and they're not fully compatible with TypeScript types |
18:49 | <Michael Ficarra> | bakkot: build loop of what? what have they written? |
18:51 | <bakkot> | of... programs... |
18:51 | <Robin Ricard> | I can't find my earlier comment on that, but what if you could open your editor, write some typescript code and run it in your browser |
18:51 | <Robin Ricard> | without touching stuff like npm |
18:51 | <yulia> | I will move the support comments quickly |
18:51 | <yulia> | please keep them short! |
18:52 | <TabAtkins> | The "inner loop" is the "write code, then run code" - if you're writing TS itself there's a third step of "transpile code" inbetween those two, which this proposal lets the authors avoid until they actually want to check their types |
18:52 | <pzuraq> | as a data point, I've seen people actually avoid using TS syntax despite wanting strong types/IDE support specifically because they prefer the ability to copy/paste JS into a repl |
18:52 | <Michael Ficarra> | Robin Ricard: many delegates have said that they would oppose adding he full typescript syntax here, so that is not a covered use case |
18:53 | <pzuraq> | they try to use JSDoc comments, but it's not great |
18:53 | <leobalter> | Ashley Claymore: I'm +1 to your +1 comment in the queue: this proposal set good rulers for the syntax that will support TC39 and superset frameworks such as TypeScript to expand syntax capabilities. |
18:53 | <Robin Ricard> | Robin Ricard: many delegates have said that they would oppose adding he full typescript syntax here, so that is not a covered use case |
18:53 | <pzuraq> | so I think the DX improvements of having these inline comments would actually be meaningful |
18:53 | <Robin Ricard> | that happens to match this proposal |
18:53 | <TabAtkins> | And yeah, avoiding that required transpile step in my inner loop is precisely why I don't use TS right now. |
18:53 | <Robin Ricard> | I actually meant writing ts in those comments |
18:54 | <Michael Ficarra> | then I refer back to Waldemar's comment about creating some weird hybrid between TS and JS |
18:54 | <bakkot> | yeah you couldn't use actual typescript with this proposal, they'd have to change TS syntax |
18:54 | <bakkot> | at which point... https://github.com/giltayar/proposal-types-as-comments/issues/127 |
18:54 | <Robin Ricard> | yep sorry I confused things here |
18:54 | <Michael Ficarra> | I'd be more interested in advancing this after TS/Flow devs expressed interest in making the proposed syntax valid in their languages |
18:55 | <Tierney Cyren> | Michael Ficarra: perhaps a good reply to current topic? |
18:55 | <Robin Ricard> | that actually is the current question |
18:56 | <yulia> | Jack Works: since we are low on time, can we move on to summarization? |
18:56 | <leobalter> | HTML inline comments can be considered a precedent for this proposal. Not a joke. |
18:56 | <yulia> | ok we have two such comments |
18:57 | <Robin Ricard> | yep that is fine |
18:57 | <Robin Ricard> | jsut wanted to make sure this got visible on the queue |
18:57 | <yulia> | HE Shi-Jun: sorry, we are out of time so I am cutting the queue now |
18:58 | <yulia> | please feel free to bring this up in the issue tracker |
18:58 | <Tierney Cyren> | I am people |
18:58 | <Robin Ricard> | I am people too |
18:58 | <bakkot> | problem statement needs to include "and there is no way to do this with existing comment syntax", which I am still not convinced of |
18:59 | <shu> | fwiw i still think "does TC39 care about long-term unforking of vastly popular JS forks" is a pretty important problem for the ecosystem |
18:59 | <shu> | just not one our composition is well suited for discussion |
19:00 | <Michael Ficarra> | shu: we can have a longer/open-ended discussion topic for it one day |
19:00 | <shu> | +1 |
19:00 | <HE Shi-Jun> | I am people |
19:01 | <Michael Ficarra> | I guess I can get behind stage 1 for making it more ergonomic to represent metadata in comments, but I don't see it working out well without major changes in TS/Flow |
19:01 | <leobalter> | is anyone uncomfortable with the presented developer experience? |
19:02 | <Robin Ricard> | ts/flow would probably need to run stuff by tc39 in this thoeorical unforked future before adding things |
19:02 | <leobalter> | We can't separate TypeScript from the Ecosystem. |
19:02 | <leobalter> | it's not all the JS Ecosystem, but a very relevant part of it. |
19:02 | <Tierney Cyren> | Extremely -1 on a typescript mode |
19:03 | <Michael Ficarra> | Robin Ricard: we would probably only be willing to carve out a narrow (but infinite) syntax space for them, like what bakkot suggested, and they will need to adapt |
19:03 | <Bradford Smith> | I like shu's suggestion of adding a more general feature of comments that are directly tied to syntax objects. Such comments could be use for multiple purposes, as he pointed out. I feel like people got distracted by his suggested other purposes and didn't understand what he was actually proposing. |
19:03 | <HE Shi-Jun> | I feel the ecosystem is already JS/TS , at least 50% JS devs are actually writing TS every day 😅 |
19:03 | <yulia> | SoftwareChris: we had a clarification regarding the problem statement, should it be restated? |
19:04 | <ryzokuken> | can't we conclude that the remainder of the TS features are aimed at "power users" and thus behind the compile wall? |
19:04 | <Robin Ricard> | Robin Ricard: we would probably only be willing to carve out a narrow (but infinite) syntax space for them, like what bakkot suggested, and they will need to adapt |
19:04 | <yulia> | there are two parts: 1) ergonomic types as comments that run in the browser 2) consolidating popular js forks is a problem, and ts is very popular |
19:04 | <ryzokuken> | and that we only need the small common denominator of features instead |
19:04 | <Robin Ricard> | can't we conclude that the remainder of the TS features are aimed at "power users" and thus behind the compile wall? |
19:04 | <HE Shi-Jun> | I think the problem spaces could be "narrowing the gap between JS and TS/flowtype/any other type checkers ... |
19:04 | <Michael Ficarra> | ryzokuken: sure yeah, but then we've created a hybrid/in-between language that people need to know |
19:05 | <ryzokuken> | it's just JS, people are writing JS with additional optional comments, right? |
19:05 | <bakkot> | my hope is that by carving out a space (like I proposed), then TS (and flow, and other tools) could move to that space |
19:06 | <yulia> | there are two parts: 1) ergonomic types as comments that run in the browser 2) consolidating popular js forks is a problem, and ts is very popular |
19:07 | <ljharb> | there are two parts: 1) ergonomic types as comments that run in the browser 2) consolidating popular js forks is a problem, and ts is very popular |
19:07 | <ljharb> | the first is a solution, and the second states a problem without describing why/how it's a problem |
19:07 | <ryzokuken> | "standardize somewhat the hitherto non-standard type annotation syntax that is massively popular and essentially a de-facto standard" |
19:07 | <yulia> | this is what was described by the champions |
19:08 | <ljharb> | ok so i still don't see a problem statement |
19:08 | <Michael Ficarra> | ljharb: to be fair, it's a lot closer to a problem statement than where we started! |
19:08 | <ljharb> | true |
19:09 | <shu> | ljharb: do you mean it's not a problem statement in the sense that you disagree those are problems? |
19:10 | <ljharb> | no, i mean that the problem is implicit and i don't understand what it is |
19:10 | <ljharb> | "consolidating popular JS forks" is not a problem, it's an action |
19:10 | <ljharb> | what problem does consolidating those solve |
19:10 | <bakkot> | "there are many unconsolidated forks" is a problem |
19:10 | <pzuraq> |
|
19:10 | <bakkot> | at least, some people regard it as such |
19:11 | <pzuraq> | does that sound more like a problem statement? |
19:11 | <shu> | i understand 1) to mean "some people don't like transpilation steps, and want to get rid of them" and i meant 2) as "TC39 cares about its own primacy and about JS's primacy, presumably, and forking and the rising popularity of forks is a problem" |
19:12 | <ljharb> | pzuraq: thank you, yes, that is much better |
19:12 | <ljharb> | "some people don't like transpilation steps" is not a problem i want TC39 to explore further, so hard block on stage 1 for that |
19:12 | <SoftwareChris> | does that sound more like a problem statement? |
19:12 | <yulia> | danielrosenwasser: are you available at the end of day 4 (thursday)? |
19:12 | <yulia> | we have 30 min |
19:12 | <jschoi> | Wait, sorry—did it reach Stage 1? |
19:12 | <bakkot> | jschoi: nope |
19:12 | <jschoi> | Thanks! |
19:12 | <bakkot> | so, I would actually have gone for a different problem statement, which is, "the current syntax forms for comments are unergonomic to use as inline annotations, which has lead to forks of the language" |
19:13 | <shu> | +1 |
19:13 | <bakkot> | "people want to use types without stripping them" is a subset of that problem |
19:13 | <ljharb> | either one of those (bakkot's and pzuraq's) are actual problem statements that can be meaningfully discussed |
19:13 | <Devin Rousso> | Jack Works: my only point was that you said something like "we should try to add those transpilers in the devtools" and i just wanted to respond that we can only have that be a request, not a requirement |
19:13 | <ljharb> | thank you |
19:14 | <SoftwareChris> | so are those of us that like dynamic/weak typing going to be dragged kicking and screaming into the world of strong typing? asking for a friend |
19:14 | <Ben Newman (Apollo, @benjamn on GH)> | did everyone understand Shu's comment about this proposal allowing for "unambiguous comment attribution" (that is, attribution to AST nodes) |
19:14 | <ljharb> | comment attachment is definitely an issue for tooling |
19:14 | <Ben Newman (Apollo, @benjamn on GH)> | it would be really cool to have a kind of comment that is syntactically associated with a specific non-comment parse node |
19:14 | <shu> | SoftwareChris: the only comment in the direction of having actual types has been from Waldemar. champions have strongly disavowed that as a goal thus far |
19:15 | <Ben Newman (Apollo, @benjamn on GH)> | trailing/leading/dangling comments are a heuristic nightmare for AST tooling |
19:15 | <pzuraq> | SoftwareChris: I think the fact that this proposal isn't actually trying to add real typing shows that's not the case? |
19:15 | <Ashley Claymore> | so are those of us that like dynamic/weak typing going to be dragged kicking and screaming into the world of strong typing? asking for a friend // tool-disable-checking-next-line is your new best friend! :D |
19:16 | <SoftwareChris> | |
19:16 | <pzuraq> | FWIW I was quite skeptical of strong typing for some time after a few years of terrible Java/C experiences, but I've come around to enjoying the latest wave of typed languages a lot |
19:16 | <Tierney Cyren> | Types as Comments strives to provide a foundational building block within the language upon which type systems can grow off of. Having such a system tackles multiple problems on different parts of the ecosystem:
Additionally, both of those end up benefitting the overall ecossytem in that we get a lower barrier to types and the resources of a Microsoft or a Facebook aren't required to build nifty and useful tooling around types which helps support the next innovation in types. |
19:16 | <Tierney Cyren> | ^ my thoughts as someone who didn't contribute to the proposal and is relatively anti-typescript in their own projects |
19:17 | <pzuraq> | but I still think that weak JS should always be an option, I drop down to it on occasion when I'm just sketching things out |
19:17 | <ljharb> | "actual comments" would work fine for those purposes too tho |
19:17 | <ljharb> | they're just slightly less ergonomic, and attachment is trickier |
19:17 | <Ben Newman (Apollo, @benjamn on GH)> | ljharb: that gap is worth closing IMO |
19:17 | <pzuraq> | ljharb: the existence of another language specifically to close that gap is pretty solid evidence that the ergonomics are not good enough, no? |
19:17 | <Tierney Cyren> | "actual comments" would work fine for those purposes too tho |
19:18 | <Ben Newman (Apollo, @benjamn on GH)> | it's infinitely trickier, in some sense (ambiguous, undecidable) |
19:18 | <Tierney Cyren> | The fact that they haven't really been selected as a solution by the community is telling imo |
19:18 | <bakkot> | day zero of typescript included runtime features as well |
19:18 | <bakkot> | and at that point, why not also have non-comment syntax forms |
19:18 | <bakkot> | flow is a better example, I think |
19:18 | <bakkot> | since it's always, only, been type annotations |
19:19 | <bakkot> | (afaik) |
19:19 | <SoftwareChris> | SoftwareChris: I think the fact that this proposal isn't actually trying to add real typing shows that's not the case? |
19:19 | <Tierney Cyren> | and at that point, why not also have non-comment syntax forms |
19:19 | <Ashley Claymore> | since it's always, only, been type annotations |
19:19 | <SoftwareChris> | the "as comments" part of it is a bit misleading |
19:19 | <pzuraq> | SoftwareChris: why would anything in this proposal impact someone who wanted to write plain JS? |
19:20 | <bakkot> | Flow also has enums :) |
19:20 | <bakkot> | guess I forgot that |
19:20 | <SoftwareChris> | SoftwareChris: why would anything in this proposal impact someone who wanted to write plain JS? |
19:20 | <pzuraq> | that's dodging the question |
19:21 | <pzuraq> | why would anyone who wants to write JS w/o comments be impacted? |
19:21 | <bakkot> | does this mean actual types? enum and whatever), it makes a lot more sense to also add other new syntax, as typescript has done |
19:21 | <yulia> | folks -- its getting a bit spicy in here |
19:21 | <bakkot> | that does not, in itself, mean that comments would not be adequate for the goal of just having types |
19:21 | <bakkot> | if you set out to do that in the first place |
19:22 | <Tierney Cyren> | I don't know what "actual types" means. what I'm saying that if you're already committed to not being legal JS (because you have |
19:22 | <SoftwareChris> | see my comment about it becoming the de facto standard (way of writing js) |
19:22 | <bakkot> | Tierney Cyren: all the runtime stuff they had at the beginning |
19:22 | <bakkot> | enums and decorators and stuff |
19:22 | <Tierney Cyren> | ah |
19:22 | <Tierney Cyren> | I might have been devouring a subway sandwich during that part |
19:22 | <pzuraq> | SoftwareChris right, but the standard doesn't actually prevent you from writing code not in the standard. Are you worried that companies and teams will decide to adopt it, and so it might be difficult to find a codebase to work in regularly that does not use these comments? |
19:22 | <pzuraq> | I'm just trying to understand what the concern is, concretely |
19:23 | <shu> | SoftwareChris: well, TS's meteoric rise and widespread penetration means that ship has sailed for now from where i'm sitting |
19:24 | <Robin Ricard> | bakkot: to be clear, the ts team is not specifically recommending the use of "runtime" features like enums, namespaces, and we are seeing all new feature just be purely in the "type world" |
19:24 | <bakkot> | right, but I'm talking about the history here |
19:25 | <Robin Ricard> | ok I'm a bit brain fried |
19:25 | <bakkot> | I'm just saying that the existence of typescript using non-comment syntax for types does not in itself prove that comment are not adequate for types, since when TS made the decision to not use the existing comment syntax it was basically costless, because they wanted runtime stuff, and so there was no point to being legal JS. |
19:26 | <bakkot> | (Separately, I can see an argument that the existing comment syntaxes are not adequate for types. My claim is just that the existence of TS, in itself, does not establish this.) |
19:26 | <Robin Ricard> | yes but today I can use a purely non-runtime affecting ts |
19:26 | <Robin Ricard> | and that is actually what I do as I specifically use linters to prevent me from writing ts that generates additional js |
19:26 | <bakkot> | but you can't use just comments and still use TS, except for a subset of the language and with awful ergonomics |
19:27 | <bakkot> | but that is a contingent fact about what TS has implemented, not a fact inherent in the world |
19:27 | <pzuraq> | bakkot: I think the rotation on TS is because ergonomics issues in general are really, really hard to argue, because inherently they don't really have a basis in anything other than "devs like to do it this way, generally". So we have to rely on evidence for what has actually worked in the ecosystem and what hasn't |
19:27 | <Robin Ricard> | I need colon syntax and a few statements that I wouldn't mind prefixing with colon |
19:27 | <SoftwareChris> | SoftwareChris right, but the standard doesn't actually prevent you from writing code not in the standard. Are you worried that companies and teams will decide to adopt it, and so it might be difficult to find a codebase to work in regularly that does not use these comments? |
19:27 | <pzuraq> | JSDoc has been around for decades, but it never got mainstream adoption, never got phenomenal IDE support, never was expanded upon |
19:27 | <Robin Ricard> | I can do most of my work including complex generic types in that space |
19:28 | <pzuraq> | TS has been around for less than a decade and has gotten much much further in that space |
19:28 | <ljharb> | JSDoc has been around for decades, but it never got mainstream adoption, never got phenomenal IDE support, never was expanded upon |
19:28 | <ljharb> | JSDoc was just about generating API docs, it wasn't for type checking |
19:28 | <Ashley Claymore> | One issue with existing comment syntax, that I've mentioned before, is that /* */ style comments can't be nested. And putting /// at the start of every row really needs editor support to type ergonomically. |
19:28 | <pzuraq> | ljharb: the ability to define a type system in comments has always been there, is my point |
19:28 | <ljharb> | and tsc's jsdoc dialect is missing a ton of TS features and also has a bunch of things that just don't work |
19:28 | <Tierney Cyren> | JSDoc didn't have an actual working type system to use with it |
19:28 | <ljharb> | pzuraq: right, but that nobody's done it doesn't prove it can't be done |
19:28 | <pzuraq> | JSDoc is just the closest we got to it |
19:28 | <bakkot> | flow is the closest we got |
19:28 | <pzuraq> | again, not hard evidence here, soft evidence |
19:28 | <ljharb> | JSDoc was always zero about types. it was about documentation. |
19:28 | <Tierney Cyren> | if an ecosystem type system in comments hasn't evolved and gained mass adoption at this point, I don't think it will. |
19:28 | <bakkot> | flow's type comments are much nicer than jsdoc |
19:29 | <bakkot> | https://github.com/giltayar/proposal-types-as-comments/issues/41 |
19:29 | <bakkot> | https://flow.org/en/docs/types/comments/ |
19:29 | <bakkot> | much, much nicer |
19:30 | <Ashley Claymore> | And even though Flow supports that, they still built flow-syntax parsing into their JS engine :) |
19:30 | <bakkot> | I mean if you're gonna build a js engine, why not, right |
19:30 | <pzuraq> | ljharb: sure, but the counter argument to this feature is "we could just do that in comments" and the reality is no one has done that, despite having decades of opportunity. So my point is this is soft-evidence that the concern is real and possibly worth addressing. |
19:30 | <pzuraq> | nothing can be definitely proven here, IMO |
19:31 | <ljharb> | sure |
19:31 | <Robin Ricard> | I tried to do a flow comments codebase back 3 years ago. After 2 weeks the team was begging me to remove them |
19:31 | <Robin Ricard> | It’s good for fast prototyping |
19:31 | <ljharb> | because of comments tho, or because flow's error messages were, at least at that time, inscrutable? |
19:31 | <Robin Ricard> | Same for jsdoc comments |
19:31 | <Robin Ricard> | Yea the code would be taken over by comments |
19:32 | <ljharb> | same tho. nobody's denying TS's usability improvement over the alternatives |
19:32 | <Robin Ricard> | Maybe a better syntax highlighting would have helped |
19:32 | <Ashley Claymore> | I also tried /* style type comments and my little pinky finger was not up to the amount of / I had to type |
19:32 | <ljharb> | but "taken over by types" and "taken over by comments that are types" seems the same to me |
19:32 | <bakkot> | so, I would actually have gone for a different problem statement, which is, "the current syntax forms for comments are unergonomic to use as inline annotations, which has lead to forks of the language" |
19:33 | <Ashley Claymore> | espeically as /*: is all on the right hand - really RSI inducing |
19:33 | <bakkot> | I think I can buy that /*: number */ is enough worse than : number that it constitutes a problem worth solving |
19:34 | <Robin Ricard> | but "taken over by types" and "taken over by comments that are types" seems the same to me |
19:35 | <danielrosenwasser> | danielrosenwasser: are you available at the end of day 4 (thursday)? |
19:36 | <yulia> | good, i reserved 15 minutes so we can do clean up / incubator call stuff |
19:36 | <Ashley Claymore> | in terms of innovation, a question that was asked during plenary. It feels liberating if bundlers and minifiers could forget about keeping up to date with supporting different type syntaxes, and instead use that effort for their primary use-case |
19:37 | <SoftwareChris> | not sure if the 'problem statement' was settled but in any case, can the proposal be updated with it? |
19:41 | <bakkot> | in terms of innovation, a question that was asked during plenary. It feels liberating if bundlers and minifiers could forget about keeping up to date with supporting different type syntaxes, and instead use that effort for their primary use-case |
19:45 | <Ashley Claymore> | at the last tools outreach call, I can't remember the name of the engineer, but someone on the eslint team ( I think ) said that one benefit is that it would make the plugin size smaller |
19:45 | <Ashley Claymore> | e.g. for prettier. Prettier could mostly use its own parser, and then when it sees a type-comment only defer that part to plugins, and if the plugin fails it can gracefully fallback to treating it as a comment |
19:46 | <Jack Works> | Jack Works: my only point was that you said something like "we should try to add those transpilers in the devtools" and i just wanted to respond that we can only have that be a request, not a requirement |
19:46 | <pzuraq> | having worked with those tools though it would significantly simplify them if the syntax was valid JS |
19:46 | <jschoi> | bundlers in particular would benefit, but many tools, like prettier, would actually need to parse the types themselves, and so would still rely on the more specific grammar which TS or flow or whatever actually used |
19:46 | <bakkot> | prettier does not have some generic prettifying algorithm |
19:46 | <jschoi> | I mean for the annotated types. |
19:46 | <bakkot> | I don't think you could write a semantics-agnostic algorithm for that |
19:47 | <bakkot> | people want to replace type x = { a: number, b: number } with type x = { a: number; b: number } , e.g. |
19:47 | <bakkot> | and you can't just like s/,/;/g |
19:47 | <Ashley Claymore> | right now prettier will fail to format the entire file if one line has one new bit of TS syntax that it hasn't yet added support for. With type-comments it would have a way to gracefully fail only for the parts with the unsupported syntax |
19:47 | <bakkot> | you have to actually understand the ast |
19:47 | <jschoi> | people want to replace |
19:47 | <jschoi> | Yeah, what Ashley said. Graceful degradation. |
19:47 | <jschoi> | Or progressive enhancement. Whatever. |
19:48 | <Ashley Claymore> | right now most projects have to wait until all their tools support new type syntax before they can use it anywhere. Being able to do that more gradually would be lovely |
20:04 | <gkz> | Having made a variety of contributions to Prettier, I do not see at all how it would be possible to have some kind of "progressive enhancement" or "graceful degradation" - we would be talking about creating a whole new tool |
20:05 | <Devin Rousso> | adding it to the language is request every engine to implement it, I think they're the same thing |
20:08 | <Jack Works> | i feel like we're talking past eachother here a bit. are you suggesting that we consider the TypeScript transpiler "standardized"? or are you just suggesting that we add developer tooling support for the types as comments proposal that was presented earlier today? |
20:09 | <Devin Rousso> | if the core need of the proposal is to run code without transpile, devtools built-in ts & flow transpile can help people so we don't have to add that in the core language 👀 |
20:10 | <Ashley Claymore> | Having made a variety of contributions to Prettier, I do not see at all how it would be possible to have some kind of "progressive enhancement" or "graceful degradation" - we would be talking about creating a whole new tool It was explained to me similar to how tools support codeblocks in markdown |
20:10 | <Devin Rousso> | like i dunno that WebKit would want to add support for TS in Web Inspector given the cadence or release cycles, availability of engineers, etc. |
20:12 | <Ashley Claymore> | And even if dev tools add support via plugins/extensions. It doesn’t solve the issue of the grammar ambiguity between js-with-types and official js. |
20:14 | <Jack Works> | sure, but TS/Flow/etc. is not standardized, so we as a standards body cannot require that developer tooling (which are all also not standardized) add support |
20:15 | <Devin Rousso> | ok cool that sounds fine 🙂 |
20:15 | <Devin Rousso> | friendly advice is good |
20:16 | <Jack Works> | An example, Firefox devtools support syntax highlighting for JSX |
20:18 | <Jack Works> | 😴 really need get to sleep, see you tomorrow |
20:28 | <pzuraq> | Having made a variety of contributions to Prettier, I do not see at all how it would be possible to have some kind of "progressive enhancement" or "graceful degradation" - we would be talking about creating a whole new tool |
20:29 | <pzuraq> | Agreed that with Prettier you pretty much have to make a whole new tool for each language combination, it's really hard to do generic things (built a few plugins for templates-in-js type things) |
22:15 | <devsnek> | terrifying reorg lol https://gc.gy/116297145.png |