[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 493403d0 1/6: Expunge facility for blocking k
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 493403d0 1/6: Expunge facility for blocking keywords at run time |
Date: |
Sat, 16 Jul 2022 11:13:48 -0400 (EDT) |
branch: master
commit 493403d0cd599da4e26bba1aa6264cb38a849cd0
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Expunge facility for blocking keywords at run time
This was used only in one case, which was determined to be
undesirable in 2010. See:
https://lists.nongnu.org/archive/html/lmi/2010-07/msg00006.html
from which it can be deduced that the idea is inherently bad
and should therefore be expunged.
---
datum_sequence.cpp | 52 ++++---------------------------------------------
datum_sequence.hpp | 10 +---------
input_harmonization.cpp | 4 ----
3 files changed, 5 insertions(+), 61 deletions(-)
diff --git a/datum_sequence.cpp b/datum_sequence.cpp
index f60ea9fb..25c776e2 100644
--- a/datum_sequence.cpp
+++ b/datum_sequence.cpp
@@ -30,7 +30,6 @@
/// Throws if insane.
sequence_base::sequence_base()
- :keyword_values_are_blocked_ {false}
{
assert_sanity();
}
@@ -41,7 +40,6 @@ sequence_base::sequence_base()
sequence_base::sequence_base(std::string const& s)
:datum_string_base {s}
- ,keyword_values_are_blocked_ {false}
{
assert_sanity();
}
@@ -52,18 +50,6 @@ sequence_base& sequence_base::operator=(std::string const& s)
return *this;
}
-/// Block or unblock keyword values.
-///
-/// This has no practical effect if keyword values are not allowable.
-///
-/// Throws if insane.
-
-void sequence_base::block_keyword_values(bool z)
-{
- keyword_values_are_blocked_ = z;
- assert_sanity();
-}
-
/// Declare whether numeric values are allowable.
bool sequence_base::numeric_values_are_allowable() const
@@ -72,8 +58,6 @@ bool sequence_base::numeric_values_are_allowable() const
}
/// Declare whether keyword values are allowable.
-///
-/// Even if they are allowable, they may be blocked.
bool sequence_base::keyword_values_are_allowable() const
{
@@ -119,29 +103,13 @@ std::map<std::string,std::string> const
sequence_base::allowed_keywords() const
bool sequence_base::equals(sequence_base const& z) const
{
- return
- z.value() == value()
- && z.keyword_values_are_blocked_ == keyword_values_are_blocked_
- ;
-}
-
-/// Determine whether keywords are blocked.
-///
-/// Rationale: to support allowed_keywords() in derived classes.
-///
-/// It would be simple to provide a public accessor for the member
-/// datum, but maintaining strong encapsulation reduces the temptation
-/// for one component of MVC to inspect another's internals.
-
-bool sequence_base::keyword_values_are_blocked() const
-{
- return keyword_values_are_blocked_;
+ return z.value() == value();
}
/// Ensure that input is possible; throw otherwise.
///
/// Input is possible iff either
-/// - keyword values are allowable and not blocked; or
+/// - keyword values are allowable, or
/// - numeric values are allowable.
/// For the nonce at least, the first condition doesn't require
/// allowed_keywords() to return a non-empty map; that can be
@@ -150,8 +118,8 @@ bool sequence_base::keyword_values_are_blocked() const
void sequence_base::assert_sanity() const
{
LMI_ASSERT
- ( (keyword_values_are_allowable() && !keyword_values_are_blocked_)
- || numeric_values_are_allowable()
+ ( keyword_values_are_allowable()
+ || numeric_values_are_allowable()
);
}
@@ -188,11 +156,6 @@ payment_sequence& payment_sequence::operator=(std::string
const& s)
std::map<std::string,std::string> const payment_sequence::allowed_keywords()
const
{
- if(keyword_values_are_blocked())
- {
- return std::map<std::string,std::string>();
- }
-
static std::map<std::string,std::string> all_keywords;
if(all_keywords.empty())
{
@@ -229,7 +192,6 @@ std::string const mode_sequence::default_keyword() const
std::map<std::string,std::string> const mode_sequence::allowed_keywords() const
{
- LMI_ASSERT(!keyword_values_are_blocked());
static std::map<std::string,std::string> all_keywords;
if(all_keywords.empty())
{
@@ -262,11 +224,6 @@ specamt_sequence& specamt_sequence::operator=(std::string
const& s)
std::map<std::string,std::string> const specamt_sequence::allowed_keywords()
const
{
- if(keyword_values_are_blocked())
- {
- return std::map<std::string,std::string>();
- }
-
static std::map<std::string,std::string> all_keywords;
if(all_keywords.empty())
{
@@ -303,7 +260,6 @@ std::string const dbo_sequence::default_keyword() const
std::map<std::string,std::string> const dbo_sequence::allowed_keywords() const
{
- LMI_ASSERT(!keyword_values_are_blocked());
static std::map<std::string,std::string> all_keywords;
if(all_keywords.empty())
{
diff --git a/datum_sequence.hpp b/datum_sequence.hpp
index 8c266e8b..73d0d57d 100644
--- a/datum_sequence.hpp
+++ b/datum_sequence.hpp
@@ -37,9 +37,7 @@
/// be specified by numbers, keywords, or a combination of both. Each
/// sequence's semantics determines whether its allowable values may
/// be numbers, or keywords, or both; that's a fixed property of each
-/// derived class. Keyword values may be blocked in context even if
-/// they would be allowed in general; that's a runtime property of
-/// each derived-class instance.
+/// derived class.
///
/// For some sequences, no keywords are defined, and therefore none
/// are ever permitted. It is difficult, e.g., to conceive of a
@@ -78,14 +76,8 @@ class sequence_base
sequence_base& operator=(std::string const&);
- void block_keyword_values(bool);
-
- bool keyword_values_are_blocked() const;
-
private:
void assert_sanity() const;
-
- bool keyword_values_are_blocked_;
};
inline sequence_base::~sequence_base() = default;
diff --git a/input_harmonization.cpp b/input_harmonization.cpp
index 9825c03f..93e9ea4d 100644
--- a/input_harmonization.cpp
+++ b/input_harmonization.cpp
@@ -567,10 +567,6 @@ false // Silly workaround for now.
// only at durations that exhibit an actual conflict: e.g., a premium
// solve for the first ten years only shouldn't inhibit anything after
// the tenth year.
-//
-// At any rate, keywords should not be blocked when the control is
-// disabled: see
-// https://lists.nongnu.org/archive/html/lmi/2010-07/msg00006.html
Payment .enable(mce_solve_ee_prem != SolveType);
CorporationPayment.enable(mce_solve_er_prem != SolveType);
- [lmi-commits] [lmi] master updated (9effa535 -> a984aa65), Greg Chicares, 2022/07/16
- [lmi-commits] [lmi] master b2c2bea1 2/6: Write certain ctors out of line, Greg Chicares, 2022/07/16
- [lmi-commits] [lmi] master 2aeeb582 4/6: Increase concinnity, Greg Chicares, 2022/07/16
- [lmi-commits] [lmi] master 53cb60b1 5/6: Make a class abstract in a different way, Greg Chicares, 2022/07/16
- [lmi-commits] [lmi] master a984aa65 6/6: Strengthen sanity preconditions, Greg Chicares, 2022/07/16
- [lmi-commits] [lmi] master 493403d0 1/6: Expunge facility for blocking keywords at run time,
Greg Chicares <=
- [lmi-commits] [lmi] master 8c961b81 3/6: Call assert_sanity() iff appropriate, Greg Chicares, 2022/07/16