From d5e1e6290bff7c11e50d8a4b40989f8b64ff6d62 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 9 Jan 2026 10:07:20 -0500 Subject: [PATCH] xo-facet: runtime facet lookup [PROTO] --- src/object2/DList.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/object2/DList.cpp b/src/object2/DList.cpp index 65b18a6..8d851e7 100644 --- a/src/object2/DList.cpp +++ b/src/object2/DList.cpp @@ -4,11 +4,15 @@ **/ #include "DList.hpp" +#include +#include #include #include namespace xo { + using xo::print::APrintable; using xo::mm::AGCObject; + using xo::facet::FacetRegistry; using xo::facet::typeseq; namespace scm { @@ -96,17 +100,28 @@ namespace xo { if (ppii.upto()) { /* perhaps print on one line */ - if (!pps->print_upto("(...)")) - return false; + pps->write("("); -#ifdef NOT_YET /* TODO: probably use iterators here, when available */ const DList * l = this; - while (!l->is_empty()) { - obj(l->head_.data()); + size_t i = 0; + while (!l->is_empty()) { + if (i > 0) + pps->write(" "); + + obj elt + = FacetRegistry::instance().variant(l->head_); + // what if no converter registered ? + + if (!pps->print_upto(elt)) + return false; + + l = l->rest_; + ++i; } -#endif + + pps->write(")"); return true; } else { pps->write("(...)");