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

FIXES: alias pm for polymeter #527

Merged
merged 2 commits into from Mar 21, 2023
Merged

FIXES: alias pm for polymeter #527

merged 2 commits into from Mar 21, 2023

Conversation

bwagner
Copy link
Contributor

@bwagner bwagner commented Mar 18, 2023

(return statement was missing)

I was looking at polymeter and when replacing polymeter by pm in the MiniRepl, I got error "Cannot read properties of undefined (reading 'note')".

FIXES: Issue #532

(return statement was missing)
@@ -1376,7 +1376,7 @@ export function polymeter(...args) {

// alias
export function pm(...args) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha thanks for the fix!

While you're here, it would probably be better to just have export pm = polymeter; instead of the function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had tried that before, but it causes an error at startup:

pattern.mjs?t=1679428469545:1142 Uncaught (in promise) ReferenceError: Cannot access 'pm' before initialization
    at pattern.mjs?t=1679428469545:1142:3

This error stems from this code:

// methods that create patterns, which are added to patternified Pattern methods
// TODO: remove? this is only used in old transpiler (shapeshifter)
Pattern.prototype.factories = {
  pure,
  stack,
  slowcat,
  fastcat,
  cat,
  timeCat,
  sequence,
  seq,
  polymeter,
  pm,
  polyrhythm,
  pr,
};
// the magic happens in Pattern constructor. Keeping this in prototype enables adding methods from the outside (e.g. see tonal.ts)

So I shifted export pm = polymeter; before that Pattern.prototype.factories statement.

@bwagner
Copy link
Contributor Author

bwagner commented Mar 21, 2023

pushed.

@bwagner bwagner requested a review from yaxu March 21, 2023 20:28
@felixroos felixroos merged commit 1313358 into tidalcycles:main Mar 21, 2023
1 check passed
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

3 participants