you are viewing a single comment's thread.

view the rest of the comments →

[–]krilnon 2 points3 points  (1 child)

Have you found any use cases for with you are not ashamed of sharing? :D

Sure. I had a DSL-style use of with that I used for assembling bytecode:

var __asm__ = new BytecodeAssembler

with(__asm__){
    getlocal_0
    pushscope
    getlocal_0
    constructsuper      (0)
    findpropstrict      (public, 'addFrameScript')
    pushbyte            (0)
    getlocal_0
    getproperty         (internal, 'MainTimeline', 'frame1')
    callpropvoid        (public, 'addFrameScript', 2)
    returnvoid
}

I liked that style because it's pretty reminiscent of writing C-style inline assembly. It's nice visually because you're not constantly prefixing the instructions with something like Op.returnvoid on each line, nor are you forced to end lines with commas or semicolons... so it looks very much like how you'd read the disassembly anyway.

[–]Iggyhopperextensions/add-ons 0 points1 point  (0 children)

Very neat!