00:06
<shu>
rbuckton: re: VSCode debugging, i don't know but i wouldn't be surprised if devtools just doesn't work because nobody has looked at it. printf debugging is what we do unfortunately, devtools investment is unlikely to materialize without something like getting to stage 3 first
00:06
<shu>
yeah, copying into normal objects sounds like it would kill performance indeed
00:06
<shu>
what are the limitations? attaching behavior and that ownProperty bug?
00:06
<shu>
(please file issues for the limitations getting in your way in addition to the attaching behaviors thing)
00:27
<rbuckton>

If I limit this to just the command line compiler, the biggest issue is that I can't emulate our internal NodeArray with a SharedArray. A NodeArray is just an Array with a few extra properties attached, but that causes several issues:

  • Can't define extra fields on SharedArray

  • Alternatively, can't define numeric indexed properties on a regular struct.

  • SharedArray is not iterable and you can't make a regular struct iterable, so I have to rewrite every for..of and array method call to work around.

00:30
<rbuckton>
We also use data structures like Map that we can't emulate due to the inability to attach behavior, so there's a lot of copying in and out of data structures we can use.
00:33
<rbuckton>
If I wanted to extend these structs to the language service, we're in the realm of needing behavior and the ability to freeze or lock down specific properties. Our AST is mostly treated as immutable, but if we were to vend struct based nodes from our API they would become unsafe to use if a consumer could make changes to properties outside of a lock.
00:37
<rbuckton>
For now I've worked around a few other issues. I add a __tag__ field to structs I create when type identity is important, as well as a field containing a pseudo- identity hash so I can use some structs as keys in a shared hashmap implementation I wrote (in place of Map where needed).
00:40
<rbuckton>
I'm using classes and decorators to fake syntax to better work with the type system, like in the example above. The decorators just collect field names and create a SharedStructType attached to the class, behavior is just defined as static methods.
00:43
<rbuckton>

I'm also experimenting with a Mutex wrapper that let's me write code like this:

{
  using lck = new UniqueLock(mutex);
  ...
}

Though the mutex wrapper is slower than Atomics.Mutex.

01:11
<rbuckton>

In reply to shu
what are the limitations? attaching behavior and that ownProperty bug?

In reply to shu
what are the limitations? attaching behavior and that ownProperty bug?

In reply to @shuyuguo:matrix.org
what are the limitations? attaching behavior and that ownProperty bug?
If I limit this to just the command line compiler, the biggest issue is that I can't emulate our internal NodeArray with a SharedArray. A NodeArray is just an Array with a few extra properties attached, but that causes several issues:

Can't define extra fields on SharedArray

Alternatively, can't define numeric indexed properties on a regular struct.

SharedArray is not iterable and you can't make a regular struct iterable, so I have to rewrite every for..of and array method call to work around.

This ended up horribly formatted due to trying to edit the message on my phone :/