Menu

#62 Macro params scope issue

1.55.2200
pending-invalid
nobody
None
5
2022-11-05
2022-01-19
ozi phantom
No

unpacking, locals and macros are wack.

_points = ((0,-3),(1,-3),(2,-2),(3,-1),(3,0),(3,1),(2,2),(1,3),(0,3),(-1,3),(-2,2),(-3,1),(-3,0),(-3,-1),(-2,-2),(-1,-3))
    .for _pon in _points[:-1]
        #mDrawPixel _pon[0],_pon[1]
        ldy BallY
    .next

this will fail as it doesn't know what _pon is for the second case

also if one doesn't do the split and uses the '*' form
#mDrawPixel *_pon
it fails
even if pon isn't local.
Seems once it gets to the second param of the macro its already in its own scope somewhere.

when in mDrawPixel is defined as a .macro and takes 2 params.

Discussion

  • Soci/Singular

    Soci/Singular - 2022-11-05
    • status: open --> pending-invalid
     
  • Soci/Singular

    Soci/Singular - 2022-11-05

    That's an expected limitation of a .macro. It's just copy/pasting the parameters as plain text. Using a .segment instead of .macro would solve the scoping problem here.

    If mDrawPixel would be a .function then the parameters would be passed properly and would work as well.

     

Log in to post a comment.

MongoDB Logo MongoDB