Comments (8)
I think I get what you're saying, but do you think you could make a standalone example just to make sure I'm getting it right?
from redex.
Yes. I was just too lazy and wanted to file the issue before I forgot the problem. I'll circle back to it.
from redex.
Standalone example:
#lang racket
(require redex/reduction-semantics)
(define-language issue-254
(Id ::= variable-not-otherwise-mentioned)
)
(define-metafunction issue-254
test-function : Id Id -> boolean
[(test-function Id_1 Id)
#t
(where/error Id Id_1)
]
)
(pretty-print (term (test-function Foo Bar)))
Running this yields:
> racket -l errortrace -l racket/base -e '(require "src/issue254.rkt")'
test-function: no clauses matched for (test-function Foo Bar)
errortrace...:
/home/nmatsakis/versioned/mir-formality/src/issue254.rkt:17:20: (test-function Foo Bar)
/home/nmatsakis/versioned/mir-formality/src/issue254.rkt:17:14: (term (test-function Foo Bar))
/home/nmatsakis/versioned/mir-formality/src/issue254.rkt:17:0: (pretty-print (term (test-function Foo Bar)))
context...:
/home/nmatsakis/stow/racket/share/pkgs/redex-lib/redex/private/error.rkt:10:0: redex-error
/home/nmatsakis/versioned/mir-formality/src/issue254.rkt:17:0
body of "/home/nmatsakis/versioned/mir-formality/src/issue254.rkt"
body of top-level
but I expect to see "define-metafunction: where/error did not match"
from redex.
@shhyou it looks like there is an explicit test case checking for something very close to this situation that disagrees with this issue.
Here's the commit and here's the relevant test case.
I am currently disagreeing with the existing test case and have put a candidate commit on a branch. There are a bunch of details in the commit because #f
can come out for a lack of a match and also because the clause returns #f
so that's why the extra thunk was introduced.
Anyway, what do you think?
from redex.
I don't really get the fix, so let me ask this instead. Does the fix distinguish between these three situations?
- Match failure in
where/error
because the shape of the pattern doesn't match - Match failure in
where/error
because repeated names are assigned non-equal values - Match failure in other
where
clauses that come afterwhere/error
in the same metafunction case
It looks like the existing code conflated case 2 and 3, which I suppose is wrong.
from redex.
I think it does!
I think the third case is separated from the second case because it goes through a different code path; a where/error
ends up in the helper function combine-where/error-results
and a where
(no /error
) ends up in combine-where-results/flatten
. (I had to change that path, but only because I changed the shape of the code that the macro generates that's in common to the two paths.)
Do you have an idea for a new test case maybe?
from redex.
Here is an attempt of case 2. I am not sure if this will take a different path from the test case at line 708--716.
(define-metafunction empty-language
[(f integer)
0
(where/error integer 3)
(where #t #t)]
[(f _) 1])
(with-handlers ([exn:fail? exn-message])
(term (f 4))) ;; => #rx"where/error"
Here is an attempt of case 3:
(define-metafunction empty-language
[(h integer)
0
(where/error integer 3)
(where integer 4)]
[(h _) 1])
(term (h 3)) ;; => should be 1
(with-handlers ([exn:fail? exn-message])
(term (h 4))) ;; => #rx"where/error"
from redex.
Thanks! I think the test case probably should be changed. If you think there is more to worry about or I'm missing something, then please let me know!
from redex.
Related Issues (20)
- Feature request: tag-with-names for apply-reduction-relation* HOT 2
- test-->>∃ #:steps n passes test if n > than the number of actual reduction steps for a term. HOT 4
- `traces` doesn't draw arrows after "fix layout" HOT 5
- `stepper` doesn't display whole term... unless I *narrow* its box?
- Feature Request: `stepper` with judgment-form use rule names
- Feature request: adjust font for `stepper` HOT 3
- Redex rejects literals at different ellipsis depths in binding form declarations HOT 1
- Generating random expressions sometimes results in an infinite loop
- where/error failures give no information about source of error HOT 6
- where/error failures don't tell you what failed to match
- using judgment-holds within define-relation HOT 1
- Redex's reduction graph windows sneakily hide part of term reductions HOT 1
- define-metafunction does not check type signature on LHS HOT 3
- Docs missing a word I can't fill in. HOT 1
- `derivation/ps` always causes an error by calling a non-existent method HOT 1
- Default rendering font changed between Racket v8.8 and v8.9? HOT 4
- Redex PDF output contains a wrong font, while Racket REPL renders the correct font HOT 2
- Reduce space between rendered rules of a judgement form HOT 3
- `traces/ps` doesn't render arrows HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redex.