weird cond expansion

Open
#835 8 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Domain
backend

Research direction

Read the discussion on issue #835 first: it reports unexpected expansion and variable leakage for (cond (else (define x 7) x)), and asks whether cond should accept branch bodies or raise an error. Compare the behavior with the R6RS specification and the Chez Scheme and Racket behavior mentioned in the issue; done means the project settles on and implements consistent behavior. The issue is nearly two and a half years old, with no recent reply.

Written by the indexing model from the issue text.

Description

Hello,

this expansion is surprising:

> (expand '(cond (else (define x 7) x)))
(begin (set! x 7) x)

No difference between cond from chezscheme or from rnrs.

If I understand correctly the spec, in R6RS it's an error.

It would be better to either make all cond branches bodies, as Racket does, or raise an error.

As it is now:

> (cond (else (define x 7) x))
7
> x
7

Cheers

Dominant language
Scheme
Stars
7.4k
Forks
1k
Avg merge
1d 20h
Merged PRs (30d)
19

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cisco/ChezScheme

All issues in cisco/ChezScheme

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.