Menu

#26 Treat the bottom of the stack as implicit ""

0.6.3
later
aditsu
None
2015-05-13
2015-02-05
No

This is an alternative suggestion to ticket 3.

Whenever an operator tries to use more operands than are present on the stack, supply empty arrays for the others. Most use-cases I can think of are source-layout challenges, but you can also consider being able to terminate a g or h loop by emptying the stack, or being able to build a string in a loop with + without having to supply an empty string manually first.

Discussion

  • aditsu

    aditsu - 2015-04-17
    • status: open --> later
    • assigned_to: aditsu
     
  • Martin Büttner

    Martin Büttner - 2015-05-13

    I have thought about this some more, and I think this could actually be even more powerful: additionally add an operator which allows to switch the element that is returned on the bottom of the stack. The default could be either 0 or "" (something falsy). I'm not entirely sure which of these is more useful - they both have their use cases. But then if I can do something like 5ev, then from then on hitting the bottom of the stack implicitly returns 5.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.