A list for the developers of CellML tools

Text archives Help


[[cellml-dev] ] libCellML - Optional values


Chronological Thread 
  • From: Randall Britten <r.britten AT auckland.ac.nz>
  • To: "cellml-tools-developers AT cellml.org" <cellml-tools-developers AT cellml.org>
  • Subject: [[cellml-dev] ] libCellML - Optional values
  • Date: Tue, 31 Mar 2015 21:49:40 +0000
  • Accept-language: en-NZ, en-US

Hi all

A few months ago, I wrote code that got through the first few use cases.
This highlighted the need to handle optional values. For example, if an XML
file is loaded into memory, and say the model element was missing the name
attribute, then the in-memory representation would return boost::none when
model.getName() was called. (Even though a model is not valid without a name
attribute, libCellML will allow processing of models that are not valid, for
example, when continuing the authoring of a partially complete model.) Using
boost::optional from the Boost library seems to be technically superior by
far than other approaches, for example using pointers, or having additional
methods, e.g. model.hasName().

David Nickerson has expressed that he prefers not to use Boost in the public
API.

Boost is pretty standard, and certainly is a well-respected library.
boost::optional itself is fairly straightforward to use.

Other uses of boost may be esoteric, and I too would rather avoid those, but
that does not mean we should reject the entire library outright, rather, we
should just assess each use of Boost on a case-by-case basis during code
review.

Please send us your feedback, we’d like to hear from the community.

Regards,
Randall Britten
______________________________________________
Bioengineering Software Development Specialist
Auckland Bioengineering Institute
University of Auckland
Auckland, New Zealand
www.abi.auckland.ac.nz





Archive powered by MHonArc 2.6.18.

Top of page