Closed Bug 904739 Opened 11 years ago Closed 11 years ago

rename actors' grip/form methods to toJSON

Categories

(DevTools :: Debugger, defect, P3)

25 Branch
x86
macOS
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 698841

People

(Reporter: fitzgen, Unassigned)

Details

(Whiteboard: [debugger-docs-needed])

This is something that it seems like everyone who works on the debugger server gets confused about. No one knows what a grip or a form is, or how they are different (which we also mess up fairly frequently). It would be a lot more obvious if we just rename them all toJSON, and then we can get the magical JSON.stringify'ing auto-calling toJSON as an added bonus (no more thing.grip() all over the place when sending packets, just use thing! woo!).
Hi, I am willing to work on this bug. So, I request you to assign me to this bug. Thanks in Advance, Regards, A. Anup
I like the toJSON idea a lot. The actors would just get toJSON methods, and then we'd stick them directly in the packets, right? But we need a precise, quick term that means what "grip" does now. Where the protocol spec says things like: "This represents an environment introduced by a <tt>with</tt> statement whose operand is <i>object</i> (a grip)." how would we write that sentence now, in a way that *spells out* what <i>object</i> must be? The spec is not the place to say, "ah, everyone knows that I really mean a grip when I say 'value'," right?
(In reply to Jim Blandy :jimb from comment #3) > I like the toJSON idea a lot. The actors would just get toJSON methods, and > then we'd stick them directly in the packets, right? ... except that we don't really use JSON.stringify in LocalDebuggerTransport or ChildDebuggerTransport.
(In reply to Jim Blandy :jimb from comment #4) > (In reply to Jim Blandy :jimb from comment #3) > > I like the toJSON idea a lot. The actors would just get toJSON methods, and > > then we'd stick them directly in the packets, right? > > ... except that we don't really use JSON.stringify in LocalDebuggerTransport > or ChildDebuggerTransport. And hopefully we don't run into any more bugs because of the differences between freezing and JSON encoding. > freeze({ foo: Infinity, bar: -0 }) > { foo: Infinity, bar: 0 } > remotify({ foo: Infinity }, bar: -0 }) > { foo: { type: "Infinity" }, bar: { type: "-0" } }
(In reply to Jim Blandy :jimb from comment #4) > (In reply to Jim Blandy :jimb from comment #3) > > I like the toJSON idea a lot. The actors would just get toJSON methods, and > > then we'd stick them directly in the packets, right? > > ... except that we don't really use JSON.stringify in LocalDebuggerTransport > or ChildDebuggerTransport. D'oh, you are correct. I still think toJSON is a better name event without the nice magic.
Whiteboard: [debugger-docs-needed]
Nick, what would you do about comment 3?
Bikeshed the name! The concept is sound (normalizing how we name this stuff and make it more self-explanatory). toRemote remotify remotable transportable Or even toGrip, along with a detailed explanation of what a "grip" is. At the very least, the name "form" needs to go because it has no explanatory power at all.
remotify is pretty good: "... whose operand is object (remotified)" I also like plain old "serialize": "... whose operand is object (serialized)."
+1 for serialize. (I was going to suggest "pickle" just to introduce a pythonism)
Priority: -- → P3
This should just go away...
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.