• Join/Login
  • Business Software
  • Open Source Software
  • For Vendors
  • Blog
  • About
  • More
    • Articles
    • Create
    • SourceForge Podcast
    • Site Documentation
    • Subscribe to our Newsletter
    • Support Request
SourceForge logo
For Vendors Help Create Join Login
SourceForge logo
Business Software
Open Source Software
SourceForge Podcast
Resources
  • Articles
  • Case Studies
  • Blog
Menu
  • Help
  • Create
  • Join
  • Login
  • Home
  • Browse
  • FMSLogo
  • Bugs
FMSLogo

macro evaluated in context of macro body not caller when output is used

A Logo programming environment for Microsoft Windows

Brought to you by: david_costanzo
  • Summary
  • Files
  • Reviews
  • Support
  • Tickets ▾
    • Feature Requests
    • Bugs
    • Support Requests
  • Discussion
  • Code
Menu ▾ ▴
  • Create Ticket
  • View Stats

Group

  • v_6.06x
  • v_6.07.X
  • v_6.08.X
  • v_6.10.X
  • v_6.11.X
  • v_6.13.X
  • v_6.22.X
  • v_6.25.X
  • v_6.26.X
  • v_6.27.X
  • v_6.28.X
  • v_6.29.X

Searches

  • Changes
  • Closed Tickets
  • Open Tickets

Help

  • Formatting Help

#599 macro evaluated in context of macro body not caller when output is used

v_6.06x
closed-fixed
nobody
None
5
2026-03-22
2025-02-03
David Costanzo
No

A macro is a procedure that outputs a list, which is then evaluated in the caller's context. However, if a macro's returned list outputs a value and that value is given as an input to a procedure, then the list is evaluated in the context of the macro's body, instead of the caller.

Consider this output

.MACRO MACRO_THING :name
  OUTPUT (LIST "THING WORD "" :name)
END

MAKE "name "value
MAKE "var "value

SHOW MACRO_THING "var
value
SHOW MACRO_THING "name
name

MACRO_THING "var outputs a list like [THING "var], which is correctly evaluated to the value of :var.

The same should be true of MACRO_THING "name. It outputs a list like [THING "name], but instead of evaluating to value of :name, it evaluates to the word name, presumably because that's the value that the parameter of MACRO_THING had when it was invoked.

Note that this is not true when a macro isn't used as an input

.MACRO MACRO_SHOW_THING :name
  OUTPUT (LIST "SHOW "THING WORD "" :name)
END

MACRO_SHOW_THING "var
value
MACRO_SHOW_THING "name
value

This bug was reported as an incidental finding in Bug #598.

Related

Bugs: #598
Bugs: #600

Discussion

  • David Costanzo

    David Costanzo - 2026-03-21

    Here's a slightly simpler macro that shows the problem:

    .MACRO MACRO_THING :name
      OUTPUT [:name]
    END
    
     
    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
  • David Costanzo

    David Costanzo - 2026-03-22
    • status: open --> closed-fixed
     
    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
  • David Costanzo

    David Costanzo - 2026-03-22

    I have committed a fix for this as [r6114]. The fix will be available in whatever version follows 8.4.0.

    The fix doesn't follow the UCBLogo code.

     

    Related

    Commit: [r6114]

    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

Log in to post a comment.

SourceForge
  • Create a Project
  • Open Source Software
  • Business Software
  • Top Downloaded Projects
Company
  • About
  • Team
  • SourceForge Headquarters
    1320 Columbia Street Suite 310
    San Diego, CA 92101
    +1 (858) 422-6466
Resources
  • Support
  • Site Documentation
  • Site Status
  • SourceForge Reviews
SourceForge logo
© 2026 Slashdot Media. All Rights Reserved.
Terms Privacy Opt Out Advertise
mdb logo