From 366ee57b2aa6428b2bf823fd044a9d5685a716cc Mon Sep 17 00:00:00 2001 From: Leandro Facchinetti Date: Thu, 14 Apr 2016 07:21:07 -0400 Subject: [PATCH] Fix `dot notation for nested hash lookups' example The previous snippet had a guard of "fender" clause that always resulted in an error, even on valid calls. The fixed snippet performs a check and only errors in bad cases. --- index.rkt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.rkt b/index.rkt index dcc7dd3..2060e6d 100644 --- a/index.rkt +++ b/index.rkt @@ -1212,7 +1212,8 @@ messages when used in error. Let's try to do that here. [(_ chain) #'(hash.refs chain #f)] [(_ chain default) - (raise-syntax-error #f "Expected hash.key0[.key1 ...] [default]" stx #'chain) + (unless (identifier? #'chain) + (raise-syntax-error #f "Expected hash.key0[.key1 ...] [default]" stx #'chain)) (let* ([chain-str (symbol->string (syntax->datum #'chain))] [ids (for/list ([str (in-list (regexp-split #rx"\\." chain-str))]) (format-id #'chain "~a" str))])