nx::next(3nx)

πŸ“¦
version 2.4.0 Β· 3 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– nx::next β€” from the NX API, bestie πŸ’–

okay so you're deep in the NX API (that's the 3nx manual section, iykyk) and you found nx::next. pop off. let's get you fluent. ✨


✨ NAME ✨

nx::next β€” skip to the next most specific method implementation 🫢


🌸 SYNOPSIS 🌸

next ?arguments?

πŸ¦‹ DESCRIPTION πŸ¦‹

πŸ’… next ?arguments?

so this one you call inside a method body, and what it does is call the next most specific method implementation in the list of available methods. and that list? it's specific to your current method-call context β€” like, it's not a global thing, it's this call's thing. 🌈

that context gets set by the usage context of nx::next, which is either method combination or method-call interception (more on both below, don't worry).

the optional arguments are the argument values you're passing into the next most specific method implementation. and here's the tea:

  • if you omit them, the arguments of the current method call get automatically forwarded. free delivery, no cap. πŸŽ€
  • if you want to call the next most specific method implementation without arguments (or you just want to suppress that argument forwarding), you have to set arguments to an empty string.
  • and if you actually need to pass an empty string as a single argument value, protect it as a list. (yes really, otherwise it reads as "no arguments please" and you'll be so confused. 😭)

the result of a call to nx::next is the result of the next most specific method implementation. simple. iconic.

but β€” plot twist β€” if there are no more further applicable methods, what nx::next returns depends on its usage context:

  • 🧡 if nx::next is used in a method body for method combination, the result will be an empty string.
  • 🚨 if nx::next is used in the body of a filter method for method-call interception, the result will be an error.
lowkey remember this one, bestie. same command, two totally different "there's nothing left" outcomes, depending on where you are. πŸ’€

πŸ‘‘ how the list actually gets built

when you execute a method call, the NX dispatch mechanism computes a list of applicable method implementations for the method name requested from a given object receiving the call. it does this in support of method combination and method-call interception. main character energy fr fr.

For method combination, the computed list contains:

  • any object-local method implementation, and
  • any method implementations the object inherited from the classes in its precedence list.

examples of that second bucket: overloading method implementations in the class hierarchy of the object, plus ones from mixin classes of the object. ⭐

For method-call interception, the computed list contains the applicable filter methods β€” again ordered by their definition order according to the precedence list of the called object. πŸ’œ


🧚 one more thing

to retrieve the next most specific method implementation to be invoked by nx::current from the internally computed list, if any, use nx::current. ✨


Copyright (c) 2014-16 Stefan Sobernig <stefan.sobernig@wu.ac.at>, Gustaf Neumann <gustaf.neumann@wu.ac.at>


and that's the whole page, bestie!! version 2.4.0 of the NX API (nx::next(3nx)), go forth and call next responsibly. mwah. πŸ’–πŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from