Skip to content

Commit

Permalink
Remove _validateFor.
Browse files Browse the repository at this point in the history
Refs #222.
  • Loading branch information
MostAwesomeDude committed Dec 3, 2020
1 parent 86bb1be commit a2049a8
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 25 deletions.
2 changes: 1 addition & 1 deletion dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def dumpLines(s):
u"Void", u"Bool", u"Bytes", u"Char", u"Double", u"Int", u"Str",
u"_makeOrderedSpace", u"Empty", u"List", u"Map", u"NullOk", u"Pair",
u"Set", u"Vow", u"_mapEmpty", u"_mapExtract", u"_accumulateList",
u"_accumulateMap", u"_booleanFlow", u"_iterForever", u"_validateFor",
u"_accumulateMap", u"_booleanFlow", u"_iterForever",
u"_switchFailed", u"_makeVerbFacet", u"_comparer", u"_suchThat",
u"_matchSame", u"_bind", u"_quasiMatcher", u"_splitList", u"import",
u"typhonEval", u"makeLazySlot", u"astBuilder", u"simple__quasiParser",
Expand Down
12 changes: 4 additions & 8 deletions mast/lib/monte/monte_expander.mt
Original file line number Diff line number Diff line change
Expand Up @@ -488,14 +488,10 @@ def expand(node, builder, fail) as DeepFrozen:
validateFor(sw.getStaticScope(key) + sw.getStaticScope(value),
sw.getStaticScope(coll), fail, span)
# `key` and `value` are patterns. We cannot permit any code to run
# within the loop until we've done _validateFor(), which normally
# means that we use temp nouns and postpone actually unifying the key
# and value until afterwards. This is a bit of a waste of time,
# especially in very tight loops, and none of our optimizers can
# improve it since it's (ironically) unsafe to move any defs around
# the _validateFor() call! So, instead, we're considering whether the
# patterns can be refuted. If a pattern is irrefutable, then we'll
# unify it directly in the method's parameters. ~ C.
# within the loop until we've match-bound these patterns. So, instead,
# we're considering whether the patterns can be refuted. If a pattern
# is irrefutable, then we'll unify it directly in the method's
# parameters, generating slightly tighter code. ~ C.
def [patts, defs] := if (key.refutable()) {
# The key is refutable, so we go with the traditional layout.
def kTemp := tempNounExpr("key", span)
Expand Down
13 changes: 0 additions & 13 deletions mast/prelude.mt
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,6 @@ def Empty := makePredicateGuard(def pred(specimen) as DeepFrozenStamp {return sp
# Alias for map patterns.
def _mapEmpty := Empty


# Must come before List. Must come after Void and Bool.
def _validateFor(flag :Bool) :Void as DeepFrozenStamp:
"Ensure that `flag` is `true`.
This object is a safeguard against malicious loop objects. A flag is set
to `true` and closed over by a loop body; once the loop is finished, the
flag is set to `false` and the loop cannot be reëntered."

if (!flag):
throw("Failed to validate loop!")

object _ListGuardStamp:
to audit(audition):
return true
Expand Down Expand Up @@ -810,7 +798,6 @@ def scopeNames := [
=> throw, => trace, => traceln,
=> _mapEmpty, => _mapExtract,
=> _accumulateList, => _accumulateMap, => _booleanFlow, => _iterForever,
=> _validateFor,
=> _switchFailed, => _makeVerbFacet, => _comparer, => _suchThat,
=> _matchSame, => _bind, => _quasiMatcher, => _splitList,
=> M, => Ref, => throw, => promiseAllFulfilled,
Expand Down
1 change: 0 additions & 1 deletion typhonTests/evens.ty

This file was deleted.

1 change: 0 additions & 1 deletion typhonTests/goal.ty

This file was deleted.

1 change: 0 additions & 1 deletion typhonTests/lue.ty

This file was deleted.

0 comments on commit a2049a8

Please sign in to comment.