xo-interpreter2 stack: modularize nth() primitive setup/install

This commit is contained in:
Roland Conybeare 2026-03-15 09:47:14 -05:00
commit 6d6066995a
7 changed files with 158 additions and 2 deletions

View file

@ -72,6 +72,7 @@ namespace xo {
template <typename Fn>
class Primitive {
public:
using FunctionPtrType = Fn;
using Traits = detail::PmFnTraits<Fn>;
using ACollector = xo::mm::ACollector;

View file

@ -0,0 +1,29 @@
/** @file ObjectPrimitives.hpp
*
* @author Roland Conybeare, Mar 2026
**/
#pragma once
#include <xo/procedure2/DPrimitive_gco_2_gco_gco.hpp>
namespace xo {
namespace scm {
/** @brief primitives centered on object2/ data structures.
*
* Note: they don't reside in object2/ because DPrimitive
* not available yet at that level
**/
class ObjectPrimitives {
public:
using AAllocator = xo::mm::AAllocator;
public:
/** create primitive for fetching nth element of a sequence **/
static DPrimitive_gco_2_gco_gco * make_nth_pm(obj<AAllocator> mm);
};
} /*namespace scm*/
} /*namespace xo*/
/* end ObjectPrimitives.hpp */

View file

@ -10,8 +10,10 @@
namespace xo {
namespace scm {
/** Register gc-aware (AGCObject,DRepr) combinations with garbage collector @p gc **/
bool procedure2_register_primitives(obj<xo::mm::AAllocator> gc, InstallSink sink);
/** Register primitive-factories **/
bool procedure2_register_primitives(obj<xo::mm::AAllocator> gc,
InstallSink sink,
InstallFlags flags);
}
}