diff --git a/CHANGELOG.md b/CHANGELOG.md index 7128620..3ffb620 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed + +- Block can be called with more parameters then it requires + +## [0.2.1] - 2022-10-21 + +### Fixed + +- Windows build doesn't require pthread dll + ## [0.2.0] - 2022-10-21 ### Added diff --git a/musique/value/block.cc b/musique/value/block.cc index f8128e3..07e9599 100644 --- a/musique/value/block.cc +++ b/musique/value/block.cc @@ -36,7 +36,7 @@ Result Block::operator()(Interpreter &i, std::vector arguments) co auto old_scope = std::exchange(i.env, context); i.enter_scope(); - if (parameters.size() != arguments.size()) { + if (parameters.size() > arguments.size()) { return errors::Wrong_Arity_Of { .type = errors::Wrong_Arity_Of::Function, // TODO Let user defined functions have name of their first assigment (Zig like) @@ -47,7 +47,7 @@ Result Block::operator()(Interpreter &i, std::vector arguments) co }; } - for (usize j = 0; j < parameters.size(); ++j) { + for (usize j = 0; j < std::min(parameters.size(), arguments.size()); ++j) { i.env->force_define(parameters[j], std::move(arguments[j])); }