Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve destructuring #182

Merged
merged 1 commit into from
Feb 19, 2024
Merged

Improve destructuring #182

merged 1 commit into from
Feb 19, 2024

Conversation

okamsn
Copy link
Owner

@okamsn okamsn commented Nov 22, 2023

  • Fix &key to support the full syntax (((KEY VAR) DEFAULT SUPPLIED), etc.)
    and add &allow-other-keys. Make a breaking change to &key
    to use &allow-other-keys and to stop being permissive.
  • Add &optional with the full syntax ((VAR DEFAULT SUPPLIED), etc.)
  • Add &map with full syntax taking from map-elt ((KEY VAR DEFAULT))

@okamsn okamsn force-pushed the destr-&optional branch 4 times, most recently from 163707d to 8e10067 Compare January 14, 2024 00:56
@okamsn okamsn force-pushed the destr-&optional branch 2 times, most recently from 6e4835e to 6df1b39 Compare January 27, 2024 20:03
@okamsn okamsn force-pushed the destr-&optional branch 15 times, most recently from 4ff3258 to 63f92a0 Compare February 19, 2024 17:29
# Basic Changes

- Update README and CHANGELOG.
- Add destructuring features
- Re-implement destructuring using `pcase`.

# More Details

## All Constructs

- Re-implement destructuring of normal values using `pcase`, reducing the
  maintenance burden and making further improvements easier.
  - Make it so that the existing destructuring features will signal
    an error if the `pcase` pattern doesn't match, instead of failing silently
    as in `pcase`.
- Support full forms being vectors as well as lists.

## `&key`

- Improve `&key`:
  - Make `&key` signal an error when there are unmatched keys in the property
    list.
  - Add `&allow-other-keys`.
  - Support the full form `((KEY VAR) DEFAULT SUPPLIED)`.

## `&map`

- Add `&map` as `(KEY VAR DEFAULT SUPPLIED)`.

- Add `&optional` form `(VAR DEFAULT SUPPLIED)`.
- Rename `loopy--parse-destructuring-accumulation-command`
  to `loopy--parse-destructuring-accumulation-command-default`
- Remove alias `loopy--destructure-generalized-variables`
  from `loopy--destructure-generalized-sequence`

## New Files

- Move some destructuring features from `loopy-misc.el` to
  `loopy-destructure.el`.
- Move some instruction features from `loopy-misc.el` to
  `loopy-instr.el`

## Test Changes

- Add many tests.
- Update the `Makefile`.
- Only test the most recent minor version of each major version.

## Removed Features

- Remove the following functions:
  - `loopy--every-other`
  - `loopy--split-list-before`
  - `loopy--split-off-last-var`
  - `loopy--destructure-sequence`
  - `loopy--destructure-list`
  - `loopy--destructure-array`
  - `loopy--generate-inc-idx-instructions`

## Added Features

- Add the following functions:
  - `loopy-seq--make-pcase-pattern`
  - `loopy--get-var-groups`
  - `loopy--get-&key-spec`
  - `loopy--get-&map-spec`
  - `loopy--get-&aux-spec`
  - `loopy--get-var-pattern`
  - `loopy--pcase-pat-positional-list-pattern`
  - `loopy--pcase-pat-positional-array-pattern`
  - `loopy--pcase-pat-&key-pattern`
  - `loopy--pcase-pat-&map-pattern`
  - `loopy--pcase-pat-&aux-pattern`
  - `loopy--pcase-destructure-for-iteration`
  - `loopy--pcase-destructure-for-with-vars`
  - `loopy--pcase-parse-for-destructuring-accumulation-command`
@okamsn okamsn merged commit 4888299 into master Feb 19, 2024
4 checks passed
@okamsn okamsn deleted the destr-&optional branch February 25, 2024 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant