๐Ÿ‘Œ A smol functional language that targets other languages

Overview

ditto

A small, pure functional language that targets other languages.

CI status Security audit status Code coverage badge

Hello world program in ditto
Syntax highlighting coming soon

Elevator pitch โฑ๏ธ

Ditto is a mashup of my favourite features from other languages.

It's functional, statically typed, and pure. But unlike many other languages in this category, it also aims to be ruthlessly simple - the syntax is small and the type system is low power.

It has no runtime of its own. There are far more mature compilers and ecosystems out there that I want to make use of, and would be naive to try and replace. So ditto can be thought of, instead, as an alternative syntax for other tools.

Ditto is not just a compiler, it's the language swiss army knife. Package management, linting, formatting, etc, are all handled by the ditto executable. Although this violates the Unix philosophy it is my hope that it makes for a better developer experience. Because developer experience matters.

Disclaimer โš ๏ธ

Ditto is still pre-v0.1 and very unstable. It is only for the curious at this stage.

Design notes

  • "There should be one - and preferably only one - obvious way to do it." - Zen of Python
  • "Small is beautiful" - Lua design
  • "Clear is better than clever" - Go Proverb
    • Alternatively, "Verbose is better than terse" - Me
    • Optimise for reading and understanding, not for writing.
  • Best practice over backwards compatibility ๐Ÿ”ฅ
  • Anti-magic. Anti-fancy.
  • Safe by default, but explicit escape hatches when you need them.
  • Embrace code generation.
Comments
  • Update Rust crate flexi_logger to 0.24

    Update Rust crate flexi_logger to 0.24

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | flexi_logger (source) | dependencies | minor | 0.22 -> 0.24 |


    Release Notes

    emabee/flexi_logger

    v0.24.1

    Some improvements in respect to use_utc:

    • add method DeferredNow::now_utc_owned()
    • documentation
    • test improvement

    v0.24.0

    Revert back to using chrono, since chrono is now fortunately maintained again and its timezone handling is fixed meanwhile

    • this change largely reverts the changes done for [0.19.6]
    • a version bump is necessary since this affects the API, e.g. in DeferredNow
    • the feature use_chrono_for_offset became obsolete and is removed

    On linux and Mac, improve the logic that handles the issue described again in issue-122.

    v0.23.3

    Re-introduce LoggerHandle::clone().

    v0.23.2

    Fix security advisory (see #โ€‹117) by replacing the dependency from notify 4.0 with notify-debouncer-mini 0.2 (which depends on notify 5.0). As a side-effect, the thread flexi_logger-specfile-watcher is replaced with notify-rs debouncer loop.

    Adapt and simplify the submodule trc a bit.

    v0.23.1

    Fix a panic that can happen if Naming::Timestamps and FileSpec::o_suffix(None) are used and rotation happens within a second (issue-116).

    Bump MSRV to 1.59 (because the time crate did this).

    v0.23.0

    Switch to edition 2021, use latest patch of time version "0.3", bump minimal supported rust version to "1.57.0".

    v0.22.6

    Add interconversions between log::LevelFilter and flexi_logger::Duplicate (kudos to rlee287).

    v0.22.5

    Only depend on the parts of crossbeam that are used (kudos to bsilver8192).

    v0.22.4

    Add support for Rfc3164 to SyslogWriter (kudos to mbodmer).

    Add Clone and Copy implementations to enum Duplicate (kudos to ComplexSpaces).

    v0.22.3

    Code maintenance: remove the feature "external_rotation".

    Bump minimal version of time crate to "0.3.7".

    v0.22.2

    Add LoggerHandle::reopen_outputfile and deprecate feature external_rotation.

    v0.22.1

    Enable symlink on all unix platforms, not just linux.

    Rework the optional syslog writer (kudos to ObsceneGiraffe):

    • bugfix: write only full lines
    • use owned buffer to avoid allocations
    • encapsulate implementation details
    • remove additional buffer from SyslogConnector::Tcp

    Add method LoggerHandle::flw_config (kudos to Ivan Azoyan).

    Reduce the used feature-list of the optional dependency chrono (to get rid of an indirect dependency to an old time version).

    Add feature external_rotation.


    Configuration

    ๐Ÿ“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    ๐Ÿšฆ Automerge: Disabled by config. Please merge this manually once you are satisfied.

    โ™ป Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ๐Ÿ”• Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    renovate 
    opened by renovate[bot] 3
  • Use an `IndexSet` for type and kind scheme variables :grimacing:

    Use an `IndexSet` for type and kind scheme variables :grimacing:

    This fixes quite a nasty bug I encountered into where an infinite substitution was being generated when forall type variables were processed in a certain order...

    Swapping out HashSet for IndexSet (to preserve insertion order) is of course not really a fix at all, as we shouldn't depend on insertion order. But fixing that will require a significant review of the type checking logic, which I don't want to be blocked on right now.

    opened by jmackie 2
  • Update Rust crate clap to v4

    Update Rust crate clap to v4

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | clap | dependencies | major | 3.2 -> 4.0 |


    Release Notes

    clap-rs/clap

    v4.0.27

    Compare Source

    Features
    • Have Arg::value_parser accept Vec<impl Into<PossibleValue>>
    • Implement Display and FromStr for ColorChoice
    Fixes
    • Remove soundness issue by switching from atty to is-terminal

    v4.0.26

    Compare Source

    Fixes
    • (error) Fix typos in ContextKind::as_str

    v4.0.25

    Compare Source

    Features
    • (error) Report available subcommands when required subcommand is missing

    v4.0.24

    Compare Source

    Fixes
    • Avoid panic when printing an argument that isn't built

    v4.0.23

    Compare Source

    Fixes
    • Don't panic on reporting invalid-long errors when followed by invalid UTF8
    • (help) Clarified argument to help subcommand

    v4.0.22

    Compare Source

    Fixes
    • (help) Don't overflow into next-line-help early due to stale (pre-v4) padding calculations

    v4.0.21

    Compare Source

    Features
    • (derive) long_about and long_help attributes, without a value, force using doc comment (before it wouldn't be set if there wasn't anything different than the short help)

    v4.0.20

    Compare Source

    Fixes
    • (derive) Allow defaulted value parser for '()' fields

    v4.0.19

    Compare Source

    Features
    • ColorChoice now implements ValueEnum

    v4.0.18

    Compare Source

    Fixes
    • (derive) Allow #[command(skip)] to also work with enum variants with a value

    v4.0.17

    Compare Source

    Fixes
    • Allow using Arg::last(true) with Arg::value_hint(ValueHint::CommandWithArguments)

    v4.0.16

    Compare Source

    Fixes
    • Arg::exclusive(true) should not be exclusive with the argument's own ArgGroup

    v4.0.15

    Compare Source

    Fixes
    • (error) Don't suggest -- when it doesn't help
    • (error) Be more consistent in quoting, punctuation, and indentation in errors

    v4.0.14

    Compare Source

    Fixes
    • Only put ArgGroup in ArgMatches whenย explicitly specified, fixing derives handling of option-flattened fields (#โ€‹4375)

    v4.0.13

    Compare Source

    Features
    • (derive) Allow () for fields to mean "don't read" (#โ€‹4371)

    v4.0.12

    Compare Source

    Features
    • Added TypedValueParser::try_map for when adapting an existing TypedValueParser can fail
    • (error) Create errors like clap with Error::new, Error::with_cmd, and Error::insert

    v4.0.11

    Compare Source

    Fixes
    • (help) Fix wrapping calculations with ANSI escape codes

    v4.0.10

    Compare Source

    Features

    v4.0.9

    Compare Source

    Fixes
    • (derive) Process doc comments for #[command(subcommand)] like in clap v3

    v4.0.8

    Compare Source

    Fixes
    • (derive) Remove a low-value assert preventing defaulting Help and Version actions

    v4.0.7

    Compare Source

    Features
    Fixes
    • (derive) Support #[group(skip)] on Parser derive
    • (derive) Tell users about implicit arg groups when running into group name conflicts
    • (error) Don't report unrelated groups in conflict or requires errors

    v4.0.6

    Compare Source

    Features

    v4.0.5

    Compare Source

    v4.0.4

    Compare Source

    Fixes
    • (error) Specialize the self-conflict error to look like clap v3

    v4.0.3

    Compare Source

    Fixes
    • (error) Quote literals consistently
    • (error) Stylize escape (--) suggestions
    • (error) Format help flag as a literal

    v4.0.2

    Compare Source

    Features
    • Have Arg::value_parser accept Vec<impl Into<PossibleValue>>
    • Implement Display and FromStr for ColorChoice
    Fixes
    • Remove soundness issue by switching from atty to is-terminal

    v4.0.1

    Compare Source

    Features
    • ColorChoice now implements ValueEnum

    v4.0.0

    Compare Source

    Highlights

    Arg::num_args(range)

    Clap has had several ways for controlling how many values will be captured without always being clear on how they interacted, including

    • Arg::multiple_values(true)
    • Arg::number_of_values(4)
    • Arg::min_values(2)
    • Arg::max_values(20)
    • Arg::takes_value(true)

    These have now all been collapsed into Arg::num_args which accepts both single values and ranges of values. num_args controls how many raw arguments on the command line will be captured as values per occurrence and independent of value delimiters.

    See Issue 2688 for more background.

    Polishing Help

    Clap strives to give a polished CLI experience out of the box with little ceremony. With some feedback that has accumulated over time, we took this release as an opportunity to re-evaluate our --help output to make sure it is meeting that goal.

    In doing this evaluation, we wanted to keep in mind:

    • Whether other CLIs had ideas that make sense to apply
    • Providing an experience that fits within the rest of applications and works across all shells

    Before:

    git
    A fictional versioning CLI
    
    USAGE:
        git <SUBCOMMAND>
    
    OPTIONS:
        -h, --help    Print help information
    
    SUBCOMMANDS:
        add      adds things
        clone    Clones repos
        help     Print this message or the help of the given subcommand(s)
        push     pushes things
        stash
    

    After:

    A fictional versioning CLI
    
    Usage: git <COMMAND>
    
    Commands:
      clone  Clones repos
      push   pushes things
      add    adds things
      stash
      help   Print this message or the help of the given subcommand(s)
    
    Options:
      -h, --help  Print help information
    
    • name/version header was removed because we couldn't justify the space it occupied when
      • Usage already includes the name
      • --version is available for showing the same thing (if the program has a version set)
    • Usage was dropped to one line to save space
    • Focus is put on the subcommands
    • Headings are now Title case
    • The more general term "command" is used rather than being explicit about being "subcommands"
    • The output is more dense with the expectation that it won't affect legibility but will allow more content
    • We've moved to a more neutral palette for highlighting elements (not highlighted above)

    In talking to users, we found some that liked clap's man-like experience. When deviating from this, we are making the assumption that those are more power users and that the majority of users wouldn't look as favorably on being consistent with man.

    See Issue 4132 for more background.

    More Dynamicism

    Clap's API has focused on &str for performance but this can make dealing with owned data difficult, like #[arg(default_value_t)] generating a String from the default value.

    Additionally, to avoid ArgMatches from borrowing (and for some features we decided to forgo), clap took the &str argument IDs and hashed them. This prevented us from providing a usable API for iterating over existing arguments.

    Now clap has switched to a string newtype that gives us the flexibility to decide whether to use &'static str, Cow<'static, str> for fast dynamic behavior, or Box<str> for dynamic behavior with small binary size.

    As an extension of that work, you can now call ArgMatches::ids to iterate over the arguments and groups that were found when parsing. The newtype Id was used to prevent some classes of bugs and to make it easier to understand when opaque Ids are used vs user-visible strings.

    Clearing Out Deprecations

    Instead of doing all development on clap 4.0.0, we implemented a lot of new features during clap 3's development, deprecating the old API while introducing the new API, including:

    • Replacing the implicit behavior for args when parsing them with ArgAction
    • Replacing various one-off forms of value validation with the ValueParser API
      • Allowing derives to automatically do the right thing for PathBuf (allowing invalid UTF-8)
    • Replacing AppSettings and ArgSettings enums with getters/setters
    • Clarifying terms and making them more consistent
    Migrating

    Steps:

    1. Upgrade to v3 if you haven't already
    2. Add CLI tests (including example below), -h and --help output at a minimum (recommendation: trycmd for snapshot testing)
    3. If using Builder API: Explicitly set the arg.action(ArgAction::...) on each argument (StoreValue for options and IncOccurrences for flags)
    4. Run cargo check --features clap/deprecated and resolve all deprecation warnings
    5. Upgrade to v4
    6. Update feature flags
    • If default-features = false, run cargo add clap -F help,usage,error-context
    • Run cargo add clap -F wrap_help unless you want to hard code line wraps
    1. Resolve compiler errors
    2. Resolve behavior changes (see "subtle changes" under BREAKING CHANGES)
    3. At your leisure: resolve new deprecation notices

    Example test (derive):

    
    #[derive(clap::Parser)]
    struct Cli {
        ...
    }
    
    #[test]
    fn verify_cli() {
        use clap::CommandFactory;
        Cli::command().debug_assert()
    }
    

    Example test (builder):

    fn cli() -> clap::Command {
        ...
    }
    
    #[test]
    fn verify_cli() {
        cli().debug_assert();
    }
    

    Note: the idiomatic / recommended way of specifying different types of args in the Builder API has changed:

    Before

    .arg(Arg::new("flag").long("flag"))  # --flag
    .arg(Arg::new("option").long("option").takes_value(true))  # --option <option>
    

    After:

    .arg(Arg::new("flag").long("flag").action(ArgAction::SetTrue))  # --flag
    .arg(Arg::new("option").long("option"))  # --option <option>
    

    In particular, num_args (the replacement for takes_value) will default appropriately from the ArgAction and generally only needs to be set explicitly for the other num_args use cases.

    Breaking Changes

    Subtle changes (i.e. compiler won't catch):

    • arg! now sets one of (#โ€‹3795):
      • ArgAction::SetTrue, requiring ArgMatches::get_flag instead of ArgMatches::is_present
      • ArgAction::Count, requiring ArgMatches::get_count instead of ArgMatches::occurrences_of
      • ArgAction::Set, requiring ArgMatches::get_one instead of ArgMatches::value_of
      • ArgAction::Append, requiring ArgMatches::get_many instead of ArgMatches::values_of
    • ArgAction::Set, ArgAction::SetTrue, and Arg::Action::SetFalse now conflict by default to be like ArgAction::StoreValue and ArgAction::IncOccurrences, requiring cmd.args_override_self(true) to override instead (#โ€‹4261)
    • By default, an Args default action is ArgAction::Set, rather than ArgAction::IncOccurrence to reduce confusing magic through consistency (#โ€‹2687, #โ€‹4032, see also #โ€‹3977)
    • mut_arg can no longer be used to customize help and version arguments, instead disable them (Command::disable_help_flag, Command::disable_version_flag) and provide your own (#โ€‹4056)
    • Removed lifetimes from Command, Arg, ArgGroup, and PossibleValue, assuming 'static. string feature flag will enable support for Strings (#โ€‹1041, #โ€‹2150, #โ€‹4223)
    • arg!(--flag <value>) is now optional, instead of required. Add .required(true) at the end to restore the original behavior (#โ€‹4206)
    • Added default feature flags, help, usage and error-context, requiring adding them back in if default-features = false (#โ€‹4236)
    • (parser) Always fill in "" argument for external subcommands to make it easier to distinguish them from built-in commands (#โ€‹3263)
    • (parser) Short flags now have higher precedence than hyphen values with Arg::allow_hyphen_values, to be consistent with Command::allow_hyphen_values (#โ€‹4187)
    • (parser) Arg::value_terminator must be its own argument on the CLI rather than being in a delimited list (#โ€‹4025)
    • (help) Line wrapping of help is now behind the existing wrap_help feature flag, either enable it or hard code your wraps (#โ€‹4258)
    • (help) Make DeriveDisplayOrder the default and removed the setting. To sort help, set next_display_order(None) (#โ€‹2808)
    • (help) Subcommand display order respects Command::next_display_order instead of DeriveDisplayOrder and using its own initial display order value (#โ€‹2808)
    • (help) Subcommands are now listed before arguments. To get the old behavior, see Command::help_template (#โ€‹4132)
    • (help) Help headings are now title cased, making any user-provided help headings inconsistent. To get the old behavior, see Command::help_template, Arg::help_heading, and Command::subcommand_help_heading (#โ€‹4132)
    • (help) "Command" is used as the section heading for subcommands and COMMAND for the value name. To get the old behavior, see Command::subcommand_help_heading and Arg::subcommand_value_name (#โ€‹4132, #โ€‹4155)
    • (help) Whitespace in help output is now trimmed to ensure consistency regardless of how well a template matches the users needs. (#โ€‹4132, #โ€‹4156)
    • (help) name/version/author are removed by default from help output. To get the old behavior, see Command::help_template. (#โ€‹4132, #โ€‹4160)
    • (help) Indentation for second-line usage changed. (#โ€‹4132, #โ€‹4188)
    • (env) Parse --help and --version like any ArgAction::SetTrue flag (#โ€‹3776)
    • (derive) Leave Arg::id as verbatim casing, requiring updating of string references to other args like in conflicts_with or requires (#โ€‹3282)
    • (derive) Doc comments for ValueEnum variants will now show up in --help (#โ€‹3312)
    • (derive) When deriving Args, and ArgGroup is created using the type's name, reserving it for future use (#โ€‹2621, #โ€‹4209)
    • (derive) next_help_heading can now leak out of a #[clap(flatten)], like all other command settings (#โ€‹4222)

    Easier to catch changes:

    • Looking up a group in ArgMatches now returns the arg Ids, rather than the values to reduce overhead and offer more flexibility. (#โ€‹4072)
    • Changed Arg::number_of_values (average-across-occurrences) to Arg::num_args (per-occurrence) (raw CLI args, not parsed values) (#โ€‹2688, #โ€‹4023)
      • num_args(0) no longer implies takes_value(true).multiple_values(true) (#โ€‹4023)
      • num_args(1) no longer implies multiple_values(true) (#โ€‹4023)
      • Does not check default or env values, only what the user explicitly passes in (#โ€‹4025)
      • No longer terminates on delimited values (#โ€‹4025)
    • Replace Arg::min_values (across all occurrences) with Arg::num_args(N..) (per occurrence) to reduce confusion over different value count APIs (#โ€‹4023)
    • Replace Arg::max_values (across all occurrences) with Arg::num_args(1..=M) (per occurrence) to reduce confusion over different value count APIs (#โ€‹4023)
    • Replace Arg::multiple_values(true) with Arg::num_args(1..) and Arg::multiple_values(false) with Arg::num_args(0) to reduce confusion over different value count APIs (#โ€‹4023)
    • Replace Arg::takes_value(true) with Arg::num_args(1) and Arg::takes_value(false) with Arg::num_args(0) to reduce confusion over different value count APIs
    • Remove Arg::require_value_delimiter, either users could use Arg::value_delimiter or implement a custom parser with TypedValueParser as it was mostly to make multiple_values(true) act like multiple_values(false) and isn't needed anymore (#โ€‹4026)
    • Arg::new("help") and Arg::new("version") no longer implicitly disable the built-in flags and be copied to all subcommands, instead disable the built-in flags (Command::disable_help_flag, Command::disable_version_flag) and mark the custom flags as global(true). (#โ€‹4056)
    • Arg::short('h') no longer implicitly disables the short flag for help, instead disable the built-in flags (Command::disable_help_flag, Command::disable_version_flag) provide your own Arg::new("help").long("help").action(ArgAction::Help).global(true). (#โ€‹4056)
    • ArgAction::SetTrue and ArgAction::SetFalse now prioritize Arg::default_missing_value over their standard behavior (#โ€‹4000)
    • Changed Arg::requires_ifs and Arg::default_value*_ifs* to taking an ArgPredicate, removing ambiguity with None when accepting owned and borrowed types (#โ€‹4084)
    • Removed PartialEq and Eq from Command so we could change external subcommands to use a ValueParser (#โ€‹3990)
    • Various Arg, Command, and ArgGroup calls were switched from accepting &[] to [] via IntoIterator to be more flexible (#โ€‹4072)
    • Arg::short_aliases and other builder functions that took &[] need the & dropped (#โ€‹4081)
    • ErrorKind and Result moved into the error module
    • ErrorKind::EmptyValue replaced with ErrorKind::InvalidValue to remove an unnecessary special case (#โ€‹3676, #โ€‹3968)
    • ErrorKind::UnrecognizedSubcommand replaced with ErrorKind::InvalidSubcommand to remove an unnecessary special case (#โ€‹3676)
    • Changed the default type of allow_external_subcommands from String to OsString as that is less likely to cause bugs in user applications (#โ€‹3990)
    • (help) Command::render_usage now returns a StyledStr (#โ€‹4248)
    • (derive) Changed the default for arguments from parse to value_parser, removing parse support (#โ€‹3827, #โ€‹3981)
      • #[clap(value_parser)] and #[clap(action)] are now redundant
    • (derive) subcommand_required(true).arg_required_else_help(true) is set instead of SubcommandRequiredElseHelp to give more meaningful errors when subcommands are missing and to reduce redundancy (#โ€‹3280)
    • (derive) Remove arg_enum attribute in favor of value_enum to match the new name (we didn't have support in v3 to mark it deprecated) (#โ€‹4127)
    • (parser) Assert when the CLI looksup an unknown args when external subcommand support is enabled to help catch bugs (#โ€‹3703)
    • (assert) Sometimes Arg::default_missing_value didn't require num_args(0..=N), now it does (#โ€‹4023)
    • (assert) Leading dashes in Arg::long are no longer allowed (#โ€‹3691)
    • (assert) Disallow more value_names than num_args (#โ€‹2695)
    • (assert) Always enforce that version is specified when the ArgAction::Version is used
    • (assert) Add missing #[track_caller]s to make it easier to debug asserts
    • (assert) Ensure overrides_with IDs are valid
    • (assert) Ensure no self-overrides_with now that Actions replace it
    • (assert) Ensure subcommand names are not duplicated
    • (assert) Assert on mut_arg receiving an invalid arg ID or mut_subcommand receiving an invalid command name
    Compatibility

    MSRV is now 1.60.0

    Deprecated

    • Arg::use_value_delimiter in favor of Arg::value_delimiter to avoid having multiple ways of doing the same thing
    • Arg::requires_all in favor of Arg::requires_ifs now that it takes an ArgPredicate to avoid having multiple ways of doing the same thing
    • Arg::number_of_values in favor of Arg::num_args to clarify semantic differences
    • default_value_os, default_values_os, default_value_if_os, and default_value_ifs_os as the non _os variants now accept either a str or an OsStr (#โ€‹4141)
    • Arg::env_os in favor of Arg::env
    • Command::dont_collapse_args_in_usage is now the default (#โ€‹4151)
    • Command::trailing_var_arg in favor of Arg::trailing_var_arg to make it clearer which arg it is meant to apply to (#โ€‹4187)
    • Command::allow_hyphen_values in favor of Arg::allow_hyphen_values to make it clearer which arg it is meant to apply to (#โ€‹4187)
    • Command::allow_negative_numbers in favor of Arg::allow_negative_numbers to make it clearer which arg it is meant to apply to (#โ€‹4187)
    • (help) Deprecated Command::write_help and Command::write_long_help in favor of Command::render_help and Command::render_long_help (#โ€‹4248)
    • (derive) structopt and clap attributes in favor of the more specific command, arg, and value to open the door for more features and clarify relationship to the builder (#โ€‹1807, #โ€‹4180)
    • (derive) #[clap(value_parser)] and #[clap(action)] defaulted attributes (its the default) (#โ€‹3976)

    Behavior Changes

    • (help) With wrap_help feature, if the terminal size cannot be determined, LINES and COLUMNS variables are used (#โ€‹4186)
    Features
    • Arg::num_args now accepts ranges, allowing setting both the minimum and maximum number of values per occurrence (#โ€‹2688, #โ€‹4023)
    • Allow non-bool value_parsers for ArgAction::SetTrue / ArgAction::SetFalse (#โ€‹4092)
    • Add From<&OsStr>, From<OsString>, From<&str>, and From<String> to value_parser! (#โ€‹4257)
    • Allow resetting most builder methods
    • Can now pass runtime generated data to Command, Arg, ArgGroup, PossibleValue, etc without managing lifetimes with the string feature flag (#โ€‹2150, #โ€‹4223)
    • New default error-context, help and usage feature flags that can be turned off for smaller binaries (#โ€‹4236)
    • Added StyledStr::ansi() to Display with ANSI escape codes (#โ€‹4248)
    • (error) Error::apply for changing the formatter for dropping binary size (#โ€‹4111)
    • (error) Error::renderfor formatting the error into a StyledStr
    • (help) Show PossibleValue::help in long help (--help) (#โ€‹3312)
    • (help) New {tab} variable for Command::help_template (#โ€‹4161)
    • (help) Command::render_help and Command::render_long_help for formatting the error into a StyledStr (#โ€‹3873, #โ€‹4248)
    • (help) Command::render_usage now returns a StyledStr (#โ€‹4248)
    Fixes
    • Verify required is not used with conditional required settings (#โ€‹3660)
    • Replaced cmd.allow_invalid_for_utf8_external_subcommands with cmd.external_subcommand_value_parser (#โ€‹3733)
    • Arg::default_missing_value now applies per occurrence rather than if a value is missing across all occurrences (#โ€‹3998)
    • arg!(--long [value]) to accept 0..=1 per occurrence rather than across all occurrences, making it safe to use with ArgAction::Append (#โ€‹4001)
    • Allow OsStrs for Arg::{required_if_eq,required_if_eq_any,required_if_eq_all} (#โ€‹4084)
    • (help) With wrap_help feature, if the terminal size cannot be determined, LINES and COLUMNS variables are used (#โ€‹4186)
    • (help) Use Command::display_name in the help title rather than Command::bin_name
    • (help) Show when a flag is ArgAction::Count by adding an ... (#โ€‹4003)
    • (help) Use a more neutral palette for coloring (#โ€‹4132, #โ€‹4117)
    • (help) Don't rely on ALL CAPS for help headers (#โ€‹4132, #โ€‹4123)
    • (help) List subcommands first, focusing the emphasis on them (#โ€‹4132, #โ€‹4125)
    • (help) Do not include global args in cmd help help (#โ€‹4131)
    • (help) Use [positional] in list when relevant (#โ€‹4144)
    • (help) Show all [positional] in usage (#โ€‹4151)
    • (help) Polish up subcommands by referring to them as commands (#โ€‹4132, #โ€‹4155)
    • (help) Trim extra whitespace to avoid artifacts from different uses of templates (#โ€‹4132, #โ€‹4156)
    • (help) Hint to the user the difference between -h / --help when applicable (#โ€‹4132, #โ€‹4159)
    • (help) Shorten help by eliding name/version/author (#โ€‹4132, #โ€‹4160)
    • (help) When short help is long enough to activate next_line_help, don't add blank lines (#โ€‹4132, #โ€‹4190)
    • (help) Make help output more dense (reducing horizontal whitespace) (#โ€‹4132, #โ€‹4192)
    • (help) Separate subcommand flags with "," like option flags (#โ€‹4232, #โ€‹4235)
    • (help) Quote the suggested help flag (#โ€‹4220)
    • (version) Use Command::display_name rather than Command::bin_name (#โ€‹3966)
    • (parser) Always fill in "" argument for external subcommands (#โ€‹3263)
    • (parser) Short flags now have higher precedence than hyphen values with Arg::allow_hyphen_values, like Command::allow_hyphen_values (#โ€‹4187)
    • (parser) Prefer InvalidSubcommand over UnknownArgument in more cases (#โ€‹4219)
    • (derive) Detect escaped external subcommands that look like built-in subcommands (#โ€‹3703)
    • (derive) Leave Arg::id as verbatim casing (#โ€‹3282)
    • (derive) Default to #[clap(value_parser, action)] instead of #[clap(parse)] (#โ€‹3827)

    v3.2.23

    Compare Source

    [3.2.23] - 2022-10-24

    Fixes
    • Upgrade to textwrap 0.16

    v3.2.22

    Compare Source

    [3.2.22] - 2022-09-16

    Fixes
    • Unify dependencies on terminal_size to the 0.2 release

    v3.2.21

    Compare Source

    [3.2.21] - 2022-09-12

    Features
    • TypedValueParser::map to allow reusing existing value parsers for other purposes

    v3.2.20

    Compare Source

    [3.2.20] - 2022-09-02

    Features
    • ArgMatches::get_count help for ArgAction::Count
    • ArgMatches::get_flag help for ArgAction::SetTrue / ArgAction::SetFalse

    v3.2.19

    Compare Source

    [3.2.19] - 2022-08-30

    Fixes
    • (help) Ensure required arguments for parent commands aren't shown in their subcommands when using args_conflicts_with_subcommand

    v3.2.18

    Compare Source

    Fixes
    • (help) Command::print_help now respects Command::colored_help
    • (derive) Improved error messages

    v3.2.17

    Compare Source

    Fixes
    • (derive) Expose #[clap(id = ...)] attribute to match Arg's latest API

    v3.2.16

    Compare Source

    Fixes
    • Ensure required arguments appear in errors when they are also members of a group (#โ€‹4004)

    v3.2.15

    Compare Source

    Features
    • (derive) New default_values_t and default_values_os_t attributes

    v3.2.14

    Compare Source

    Fixes
    • A multiple_values positional followed by another positional now works with multiple flags

    v3.2.13

    Compare Source

    Documentation
    • Pulled in tutorials, cookbook, and derive reference into rustdoc

    v3.2.12

    Compare Source

    Fixes
    • Allow an arg to declare a conflict with a group

    v3.2.11

    Compare Source

    Features
    • Added Arg::get_all_short_aliaes and Arg::get_all_aliases

    v3.2.10

    Compare Source

    Fixes
    • Loosen lifetime on Command::mut_subcommand

    v3.2.8

    Compare Source

    Features
    • Added Command::mut_subcommand to mirror Command::mut_arg

    v3.2.7

    Compare Source

    Fixes
    • Global arguments should override env-sourced arguments

    v3.2.6

    Compare Source

    Fixes
    • Don't panic when parsing --=

    v3.2.5

    Compare Source

    Fixes
    • (derive) Fix regression with #[clap(default_value_os_t ...)] introduced in v3.2.3

    v3.2.4

    Compare Source

    Fixes
    • (derive) Provide more clearer deprecation messages for #[clap(parse)] attribute (#โ€‹3832)

    v3.2.3

    Compare Source

    Fixes
    • Moved deprecations to be behind the deprecated Cargo.toml feature (#โ€‹3830)
      • For now, it is disabled by default though we are considering enabling it by default as we release the next major version to help draw attention to the deprecation migration path

    v3.2.2

    Compare Source

    Fixes
    • (derive) Improve the highlighted code for deprecation warnings

    gated behind unstable-v4

    • (derive) Default to #[clap(value_parser, action)] instead of #[clap(parse)] (#โ€‹3827)

    v3.2.1

    Compare Source

    Fixes
    • (help) Command::print_help now respects Command::colored_help
    • (derive) Improved error messages

    Configuration

    ๐Ÿ“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    ๐Ÿšฆ Automerge: Disabled by config. Please merge this manually once you are satisfied.

    โ™ป Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ๐Ÿ”• Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    renovate 
    opened by renovate[bot] 2
  • Update Rust crate path-slash to 0.2

    Update Rust crate path-slash to 0.2

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | path-slash | dependencies | minor | 0.1 -> 0.2 | | path-slash | dev-dependencies | minor | 0.1 -> 0.2 |


    Release Notes

    rhysd/path-slash

    v0.2.1

    Compare Source

    • Added CowExt::to_slash and Cow::to_slash_lossy. PathExt is no longer necessary to convert Cow<'a, Path> paths into slash paths.
    • Clarified minimum supported Rust version. Rust 1.38 or later is supported. rust-version field in Cargo.toml was added so that cargo can check the MSRV is met.
    • Improved documents of trait methods. The documents were moved from implementations of the trait methods to definitions of them so that users can find out the documents more easily. Documents for implementations are folded by default, but definitions aren't.

    [Changes][v0.2.1]

    v0.2.0

    Compare Source

    • BREAKING: to_slash and to_slash_lossy return Cow<'_, str> instead of String. Now heap allocation hapnens only when path separator is replaced. On Unix-like OS, almost all heap allocations can be removed by this change. Migrating from 0.1 to 0.2 is quite easy by adding Cow::into_owned call. If &str is sufficient for your use case, Cow::as_ref is better to avoid heap allocation. (#โ€‹9)
      use path_slash::PathExt as _;
      
      // 0.1
      let s: Option<String> = Path::new("/a/b").to_slash();
      let s: String = Path::new("/a/b").to_slash_lossy();
      // 0.2
      let s: Option<String> = Path::new("/a/b").to_slash().map(Cow::into_owned);
      let s: String = Path::new("/a/b").to_slash_lossy().into_owned();
      

      API changes are as follows:

      • 0.1.5
        • Path::to_slash(&self) -> Option<String>
        • Path::to_slash_lossy(&self) -> String
      • 0.2.0
        • Path::to_slash(&self) -> Option<Cow<'_, Path>>
        • Path::to_slash_lossy(&self) -> Cow<'_, Path>
    • BREAKING: Fix inconsistency on Windows and on Unix-like OS in terms of trailing slash in path. Now a trailing slash in path is always preserved. (#โ€‹10)
      // 0.1
      #[cfg(target_os = "windows")]
      assert_eq!(Path::new(r"\a\b\").to_slash_lossy(), "/a/b"); // Trailing slash is removed
      #[cfg(not(target_os = "windows"))]
      assert_eq!(Path::new("/a/b/").to_slash_lossy(), "/a/b/"); // Trailing slash is preserved
      
      // 0.2
      #[cfg(target_os = "windows")]
      assert_eq!(Path::new(r"\a\b\").to_slash_lossy(), "/a/b/"); // Trailing slash is preserved
      #[cfg(not(target_os = "windows"))]
      assert_eq!(Path::new("/a/b/").to_slash_lossy(), "/a/b/"); // Trailing slash is preserved
      
    • New API path_slash::CowExt is added to extend Cow<'_, Path>. Its methods convert slash paths into Cow<'_, Path>. It is useful to avoid heap allocations as much as possible compared with PathBufExt. See the API document for more details. (#โ€‹9)
      use path_slash::CowExt as _;
      let p = Cow::from_slash("foo/bar/piyo.txt"); // Heap allocation only happens on Windows
      
      #[cfg(target_os = "windows")]
      assert_eq!(p, Cow::Owned(PathBuf::from(r"foo\bar\piyo.txt")));
      #[cfg(not(target_os = "windows"))]
      assert_eq!(p, Cow::Borrowed(Path::new("foo/bar/piyo.txt")));
      

      All methods added by importing CowExt are as follows:

      • Cow::<Path>::from_slash(s: &str) -> Self
      • Cow::<Path>::from_slash_lossy(s: &OsStr) -> Self
      • Cow::<Path>::from_backslash(s: &str) -> Self
      • Cow::<Path>::from_backslash_lossy(s: &OsStr) -> Self
    • More tests are added. Now the line coverage is 100%.
      • UTF-16 test cases for native encoding on Windows
      • All error cases including broken UTF-8 and UTF-16 sequences

    [Changes][v0.2.0]

    v0.1.5

    Compare Source

    • Add new APIs to convert backslash paths to PathBuf. (#โ€‹8, thanks @โ€‹picobyte)
      • PathBuf::from_backslash converts &str into PathBuf with replacing \ on non-Windows OS
      • PathBuf::from_backslash_lossy converts &OsStr into PathBuf with replacing \ on non-Windows OS

    [Changes][v0.1.5]

    v0.1.4

    Compare Source

    • Fix a final letter of paths with some verbatim prefixes was removed (#โ€‹5)

    [Changes][v0.1.4]

    v0.1.3

    Compare Source

    [Changes][v0.1.3]

    v0.1.2

    Compare Source

    • Fix: Root path separator was doubled when the path contains Windows driver letter. For example, when C:/foo was given, to_slash converted it to C:\\foo. In this version it converts it to C:\foo correctly.
    • Improve: Remove a redundant allocation at calling to_slash() method.

    Changes

    v0.1.1

    Compare Source


    Configuration

    ๐Ÿ“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    ๐Ÿšฆ Automerge: Disabled by config. Please merge this manually once you are satisfied.

    โ™ป Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ๐Ÿ”• Ignore: Close this PR and you won't be reminded about these updates again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    renovate 
    opened by renovate[bot] 2
  • Add `lsp-test` โšก

    Add `lsp-test` โšก

    Adds some initial language server tests using lsp-test.

    As this is a Haskell library, I've also added https://github.com/haskell/actions to the CI workflow.

    Also did a bit of cleanup of the ditto-lsp code ๐Ÿงน

    opened by jmackie 2
  • Treat integer literals as natural numbers

    Treat integer literals as natural numbers

    Mostly a renaming exercise of s/Int/Nat/g.

    Natural numbers (i.e. the set of non-negative integers) are a useful type that is unfortunately missing from many languages. Take Array.get and String.length as examples of essential functions that imply non-negativity, but often don't capture that in their type. The exception being languages (often lower-level languages) that have a concept of "unsigned integers".

    Seeing as Ditto doesn't support negative integer literals (i.e. -5) we have the opportunity to make natural numbers ergonomic by making integer literals type Nat ๐ŸŽ‰ .

    This change implies that Int becomes a foreign type defined in core (as it is no longer a primitive), along with conversion functions like:

    • Nat.to_int : (Nat) -> Int
    • Int.to_nat : (Int) -> Maybe(Nat)
    • Nat.negate : (Nat) -> Int.

    Relatedly, I'm now starting to think we won't support arithmetic operators in the language at all, and defer to functions instead (lisp style). This is a trade-off I'm happy with given that Ditto isn't a language targeting numerical applications.

    opened by jmackie 2
  • Dodgy parse error when expected token is at the end of a line

    Dodgy parse error when expected token is at the end of a line

    Compiling the following module:

    module Issue34 exports (..)
    
    huh = 42;
    

    Prints:

      ร— syntax error
       โ•ญโ”€[src/Test.ditto:2:1]
     2 โ”‚
       ยท  โ–ฒ
       ยท  โ•ฐโ”€โ”€ expected: semicolon
     3 โ”‚ huh = 42;
       ยท โ–ฒ
       ยท โ•ฐโ”€โ”€ expected: semicolon
       โ•ฐโ”€โ”€โ”€โ”€
    

    But I would expect:

      ร— syntax error
       โ•ญโ”€[src/Test.ditto:1:1]
     1 โ”‚ module Issue34 exports (..)
       ยท                              โ–ฒ
       ยท                              โ•ฐโ”€โ”€ expected: semicolon
       โ•ฐโ”€โ”€โ”€โ”€
    

    This is a known issue in miette (zkat/miette#130) so we need to look at pushing a fix there.

    bug 
    opened by jmackie 2
  • Update Rust crate lsp-server to 0.6

    Update Rust crate lsp-server to 0.6

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | lsp-server | dependencies | minor | 0.5 -> 0.6 |


    Release Notes

    rust-analyzer/lsp-server

    v0.6.0

    Compare Source

    v0.5.2

    Compare Source

    v0.5.1

    Compare Source


    Configuration

    ๐Ÿ“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    ๐Ÿšฆ Automerge: Disabled by config. Please merge this manually once you are satisfied.

    โ™ป Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ๐Ÿ”• Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    renovate 
    opened by renovate[bot] 2
  • Update Rust crate dprint-core to 0.59

    Update Rust crate dprint-core to 0.59

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | dprint-core (source) | dependencies | minor | 0.54 -> 0.59 |


    Configuration

    ๐Ÿ“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    ๐Ÿšฆ Automerge: Disabled by config. Please merge this manually once you are satisfied.

    โ™ป Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ๐Ÿ”• Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    renovate 
    opened by renovate[bot] 2
  • Add boolean (binary) operators

    Add boolean (binary) operators

    Namely and and or (I prefer the python-style words here).

    x = true and false;
    y = some_var or some_other_var;
    

    I'd like to have an xor operator, but this isn't supported in all languages so would complicate code generation in some cases (and tbh I don't really think it's worth the hassle).

    enhancement 
    opened by jmackie 2
  • Fix required ditto version checking

    Fix required ditto version checking

    I tried adding a required ditto version to https://github.com/ditto-lang/std

    diff --git a/ditto.toml b/ditto.toml
    index 835b5b2..691be46 100644
    --- a/ditto.toml
    +++ b/ditto.toml
    @@ -1,5 +1,6 @@
     name = "std"
     targets = ["web", "nodejs"]
    +ditto-version = ">=0.0.2"
    

    But that complained with:

      ร— error generating build.ninja
      โ•ฐโ”€โ–ถ ditto version requirement not met for current_package: current version = 0.0.2-1-g2ea38ab, wanted = >=0.0.2
    

    Maybe there's a way to specify in the requirement that pre should be ignored, but I also think ditto-version = ">=0.0.2" should just work. This PR makes it so.

    (I also took the underscore out of current_package while I was there)

    opened by jmackie 1
  • Update Node.js to v18.13.0

    Update Node.js to v18.13.0

    Mend Renovate

    This PR contains the following updates:

    | Package | Update | Change | |---|---|---| | node | minor | 18.9.1 -> 18.13.0 |


    Release Notes

    nodejs/node

    v18.13.0: 2023-01-05, Version 18.13.0 'Hydrogen' (LTS), @โ€‹danielleadams

    Compare Source

    Notable changes
    Add support for externally shared js builtins

    By default Node.js is built so that all dependencies are bundled into the Node.js binary itself. Some Node.js distributions prefer to manage dependencies externally. There are existing build options that allow dependencies with native code to be externalized. This commit adds additional options so that dependencies with JavaScript code (including WASM) can also be externalized. This addition does not affect binaries shipped by the Node.js project but will allow other distributions to externalize additional dependencies when needed.

    Contributed by Michael Dawson in #โ€‹44376

    Introduce File

    The File class is part of the FileAPI. It can be used anywhere a Blob can, for example in URL.createObjectURL and FormData. It contains two properties that Blobs do not have: lastModified, the last time the file was modified in ms, and name, the name of the file.

    Contributed by Khafra in #โ€‹45139

    Support function mocking on Node.js test runner

    The node:test module supports mocking during testing via a top-level mock object.

    test('spies on an object method', (t) => {
      const number = {
        value: 5,
        add(a) {
          return this.value + a;
        },
      };
      t.mock.method(number, 'add');
    
      assert.strictEqual(number.add(3), 8);
      assert.strictEqual(number.add.mock.calls.length, 1);
    });
    

    Contributed by Colin Ihrig in #โ€‹45326

    Other notable changes
    • build:
      • disable v8 snapshot compression by default (Joyee Cheung) #โ€‹45716
    • crypto:
    • deps:
    • doc:
    • lib:
    • net:
      • (SEMVER-MINOR) add autoSelectFamily and autoSelectFamilyAttemptTimeout options (Paolo Insogna) #โ€‹44731
    • src:
      • (SEMVER-MINOR) add uvwasi version (Jithil P Ponnan) #โ€‹45639
      • (SEMVER-MINOR) add initial shadow realm support (Chengzhong Wu) #โ€‹42869
    • test_runner:
      • (SEMVER-MINOR) add t.after() hook (Colin Ihrig) #โ€‹45792
      • (SEMVER-MINOR) don't use a symbol for runHook() (Colin Ihrig) #โ€‹45792
    • tls:
      • (SEMVER-MINOR) add "ca" property to certificate object (Ben Noordhuis) #โ€‹44935
      • remove trustcor root ca certificates (Ben Noordhuis) #โ€‹45776
    • tools:
    • util:
    Commits

    Configuration

    ๐Ÿ“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    ๐Ÿšฆ Automerge: Enabled.

    โ™ป Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ๐Ÿ”• Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    renovate 
    opened by renovate[bot] 0
  • Avoid recomputation when handling `let` patterns

    Avoid recomputation when handling `let` patterns

    Need to do something similar to #114 only for let bindings.

    For example:

    module Example exports (..);
    
    
    type T = T(Int);
    
    some_expensive_function = fn (i) -> T(i);
    
    fixme =
        let
            T(i) = some_expensive_function(5000);
        in
        i;
    

    Generates:

    function T($0) {
      return ["T", $0];
    }
    function some_expensive_function(i) {
      return T(i);
    }
    const fixme = (() => {
      if (some_expensive_function(5000)[0] === "T") {
        const i = some_expensive_function(5000)[1];  // ISSUE: some_expensive_function called again!
        return i;
      }
      throw new Error("Pattern match error");
    })();
    export { fixme, some_expensive_function, T };
    
    enhancement 
    opened by jmackie 0
  • Update Rust crate tokio to 1.23 [SECURITY]

    Update Rust crate tokio to 1.23 [SECURITY]

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | tokio (source) | dependencies | minor | 1.22 -> 1.23 |

    GitHub Vulnerability Alerts

    CVE-2023-22466

    Impact

    When configuring a Windows named pipe server, setting pipe_mode will reset reject_remote_clients to false. If the application has previously configured reject_remote_clients to true, this effectively undoes the configuration. This also applies if reject_remote_clients is not explicitly set as this is the default configuration and is cleared by calling pipe_mode.

    Remote clients may only access the named pipe if the named pipe's associated path is accessible via a publically shared folder (SMB).

    Patches

    The following versions have been patched:

    • 1.23.1
    • 1.20.3
    • 1.18.4

    The fix will also be present in all releases starting from version 1.24.0.

    Named pipes were introduced to Tokio in version 1.7.0, so releases older than 1.7.0 are not affected.

    Workarounds

    Ensure that pipe_mode is set first after initializing a ServerOptions. For example:

    let mut opts = ServerOptions::new();
    opts.pipe_mode(PipeMode::Message);
    opts.reject_remote_clients(true);
    

    References

    https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createnamedpipea#pipe_reject_remote_clients


    Release Notes

    tokio-rs/tokio

    v1.23.1: Tokio v1.23.1

    Compare Source

    This release forward ports changes from 1.18.4.

    Fixed
    • net: fix Windows named pipe server builder to maintain option when toggling pipe mode (#โ€‹5336).

    v1.23.0: Tokio v1.23.0

    Compare Source

    Fixed
    • net: fix Windows named pipe connect (#โ€‹5208)
    • io: support vectored writes for ChildStdin (#โ€‹5216)
    • io: fix async fn ready() false positive for OS-specific events (#โ€‹5231)
    Changed
    • runtime: yield_now defers task until after driver poll (#โ€‹5223)
    • runtime: reduce amount of codegen needed per spawned task (#โ€‹5213)
    • windows: replace winapi dependency with windows-sys (#โ€‹5204)

    Configuration

    ๐Ÿ“… Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

    ๐Ÿšฆ Automerge: Enabled.

    โ™ป Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    ๐Ÿ”• Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    renovate 
    opened by renovate[bot] 0
  • `ast::Type` pretty printer :nail_care:

    `ast::Type` pretty printer :nail_care:

    Stop using debug_render and write proper formatting logic.

    Probably belongs in ditto-fmt (e.g. ditto_fmt::format_type).

    There should be a heuristic for unnamed type variable formatting that attempts to assign them single letter names (a, b, c, ...) avoiding collisions with existing named variables.

    Types should ideally be printed with consideration for their typing Environment - i.e. they should be rendered as they would appear in the module source given the imports.

    Use it for type errors, the LSP #142, generated docs #63 etc.

    enhancement 
    opened by jmackie 0
  • Erase private type aliases from exports

    Erase private type aliases from exports

    Similar to #157, but for type alias.

    In this case we don't need to raise an error, we should just erase the alias from the relevant export.

    For example:

    module Example exports (
        five,  -- should have type `Float` because `Double` isn't exported
    );
    
    type Double = Float;
    
    five : Double = 5.0;
    
    enhancement 
    opened by jmackie 0
Releases(0.0.2)
  • 0.0.2(Jan 5, 2023)

    The objective for this milestone was to have enough of a language to support a standard library.

    :heavy_check_mark: https://github.com/ditto-lang/std

    But that's not all. I got carried away and also built the packages for a simple Elm-like framework :man_dancing:

    :heavy_check_mark: https://github.com/ditto-lang/js-ref :heavy_check_mark: https://github.com/ditto-lang/js-exception :heavy_check_mark: https://github.com/ditto-lang/js-unknown :heavy_check_mark: https://github.com/ditto-lang/js-task :sparkles: https://github.com/ditto-lang/vdom

    And that framework can produce a working TodoMVC example!

    :open_mouth: https://github.com/ditto-lang/todomvc

    What's Changed

    A helluva lot. The highlights of which are:

    • if then else expressions #21
    • match expressions #22
    • do expressions #35
    • |> operator #41
    • _unused names #45
    • Exhaustiveness checking #47
    • Record literals #54
    • Parsing speed gains from a https://github.com/lalrpop/lalrpop rewrite #56 :zap:
    • type alias #92
    • Irrefutable patterns in function binders #94
    • let bindings #95 #101
    • Record updates #96
    • Remove (GitHub) packages #109 #119

    Future releases will be less chonky/more incremental, promise.

    Below are the generated release notes. Although they're not an exhaustive list of the changes as I've pushed a fair bit straight to main :cowboy_hat_face: (PRs only from now on though...new year new me)

    • Allow underscores in number literals by @wackbyte in https://github.com/ditto-lang/ditto/pull/20
    • Add if-then-else expressions by @wackbyte in https://github.com/ditto-lang/ditto/pull/21
    • Update shell.nix by @wackbyte in https://github.com/ditto-lang/ditto/pull/25
    • Format lambda body like value declaration expressions by @jmackie in https://github.com/ditto-lang/ditto/pull/31
    • Don't run expensive workflow jobs for draft PRs by @jmackie in https://github.com/ditto-lang/ditto/pull/33
    • Add match expressions by @jmackie in https://github.com/ditto-lang/ditto/pull/22
    • Stop converting case for JavaScript identifiers by @jmackie in https://github.com/ditto-lang/ditto/pull/37
    • Add do expressions by @jmackie in https://github.com/ditto-lang/ditto/pull/35
    • Add the pipe operator |> by @jmackie in https://github.com/ditto-lang/ditto/pull/41
    • Add _unused names by @jmackie in https://github.com/ditto-lang/ditto/pull/45
    • Add a simple exhaustiveness checker ๐Ÿง by @jmackie in https://github.com/ditto-lang/ditto/pull/47
    • Init JavaScript rewrite rules ๐Ÿ˜ by @jmackie in https://github.com/ditto-lang/ditto/pull/49
    • Add some more JavaScript rewrite rules โšก by @jmackie in https://github.com/ditto-lang/ditto/pull/52
    • Add record literals and field access โบ๏ธ by @jmackie in https://github.com/ditto-lang/ditto/pull/54
    • Attempt to fix slow pest parser ๐Ÿ˜ž by @jmackie in https://github.com/ditto-lang/ditto/pull/55
    • Add a (gibberish) CST generator script for benchmarking by @jmackie in https://github.com/ditto-lang/ditto/pull/58
    • Reimplement the parser with LALRPOP and logos lexer ๐Ÿ™Œ by @jmackie in https://github.com/ditto-lang/ditto/pull/56
    • Use ditto-src and ditto-test by @jmackie in https://github.com/ditto-lang/ditto/pull/67
    • Add lsp-test โšก by @jmackie in https://github.com/ditto-lang/ditto/pull/72
    • Stop messing around with line endings, just use LF ๐Ÿ‘จโ€โš–๏ธ by @jmackie in https://github.com/ditto-lang/ditto/pull/89
    • Improve CLI tests by @jmackie in https://github.com/ditto-lang/ditto/pull/87
    • Store literal expression type in the AST by @jmackie in https://github.com/ditto-lang/ditto/pull/90
    • Replace assert_module_ok! with trycmd tests ๐Ÿง‘โ€๐Ÿ’ป by @jmackie in https://github.com/ditto-lang/ditto/pull/91
    • Add type alias ๐Ÿ•ต๏ธ by @jmackie in https://github.com/ditto-lang/ditto/pull/92
    • Allow irrefutable patterns as function parameters by @jmackie in https://github.com/ditto-lang/ditto/pull/94
    • Support let bindings in Effect blocks by @jmackie in https://github.com/ditto-lang/ditto/pull/95
    • Use cargo-nextest ๐Ÿš€ by @jmackie in https://github.com/ditto-lang/ditto/pull/93
    • Drop our snapshot-test crate for datatest-stable ๐Ÿ—‘๏ธ by @jmackie in https://github.com/ditto-lang/ditto/pull/97
    • Use trycmd for ditto-make integration tests by @jmackie in https://github.com/ditto-lang/ditto/pull/98
    • Record updates ๐Ÿ‘Œ by @jmackie in https://github.com/ditto-lang/ditto/pull/96
    • Vendor tree-sitter things by @jmackie in https://github.com/ditto-lang/ditto/pull/102
    • Add let expressions by @jmackie in https://github.com/ditto-lang/ditto/pull/101
    • Add ditto-highlight crate ๐Ÿ’… by @jmackie in https://github.com/ditto-lang/ditto/pull/107
    • Type annotate empty arrays (with JSDoc) by @jmackie in https://github.com/ditto-lang/ditto/pull/108
    • Add support for github packages :octocat: by @jmackie in https://github.com/ditto-lang/ditto/pull/109
    • Fix unused JavaScript identifiers :wrench: by @jmackie in https://github.com/ditto-lang/ditto/pull/110
    • Fix aliased function type checking by @jmackie in https://github.com/ditto-lang/ditto/pull/111
    • Store any type annotations in the AST by @jmackie in https://github.com/ditto-lang/ditto/pull/112
    • Assign matched expressions to variables in generated JavaScript โšก by @jmackie in https://github.com/ditto-lang/ditto/pull/114
    • Fix type alias substitution by @jmackie in https://github.com/ditto-lang/ditto/pull/118
    • Shared package sets :package: by @jmackie in https://github.com/ditto-lang/ditto/pull/119
    • Cache fetched package sets :floppy_disk: by @jmackie in https://github.com/ditto-lang/ditto/pull/125

    New Contributors

    • @wackbyte made their first contribution in https://github.com/ditto-lang/ditto/pull/20

    Full Changelog: https://github.com/ditto-lang/ditto/compare/0.0.1...0.0.2

    Source code(tar.gz)
    Source code(zip)
    ditto-linux.sha256(64 bytes)
    ditto-linux.zip(7.01 MB)
    ditto-macos.sha256(64 bytes)
    ditto-macos.zip(5.51 MB)
    ditto-windows.sha256(64 bytes)
    ditto-windows.zip(4.92 MB)
  • 0.0.1(Apr 3, 2022)

    First public release, and coincides with the compiler source code being made public.

    Most of the important functionality exists but is very rudimentary.

    Namely, there is:

    • A parser, typechecker, and linter for an initial module syntax. The expression language is very limited at this stage.
    • A JavaScript code generator.
    • A build system based on Ninja.
    • A basic package manager, based on package sets and local package directories.
    • A fairly naive code formatter.
    • A language server with documentFormattingProvider and semanticTokensProvider capabilities. Which are enough to power a basic VS Code extension.
    Source code(tar.gz)
    Source code(zip)
    ditto-linux.sha256(64 bytes)
    ditto-linux.zip(5.60 MB)
    ditto-macos.sha256(64 bytes)
    ditto-macos.zip(4.31 MB)
    ditto-windows.sha256(64 bytes)
    ditto-windows.zip(3.77 MB)
Owner
ditto
ditto
An asynchronous runtime compatible with WebAssembly and non-WebAssembly targets.

Promise x Tokio = Prokio An asynchronous runtime compatible with WebAssembly and non-WebAssembly targets. Rationale When designing components and libr

Yew Stack 29 Feb 6, 2023
The Rust Compiler Collection is a collection of compilers for various languages, written with The Rust Programming Language.

rcc The Rust Compiler Collection is a collection of compilers for various languages, written with The Rust Programming Language. Compilers Language Co

null 2 Jan 17, 2022
Functional Reactive Programming library for Rust

Carboxyl is a library for functional reactive programming in Rust, a functional and composable approach to handle events in interactive applications.

Emilia Bopp 379 Dec 25, 2022
High-order Virtual Machine (HVM) is a pure functional compile target that is lazy, non-garbage-collected and massively parallel

High-order Virtual Machine (HVM) High-order Virtual Machine (HVM) is a pure functional compile target that is lazy, non-garbage-collected and massivel

null 5.5k Jan 2, 2023
ShakeFlow: Functional Hardware Description with Latency-Insensitive Interface Combinators

ShakeFlow: Functional Hardware Description with Latency-Insensitive Interface Combinators This repository contains the artifact for the following pape

KAIST Concurrency & Parallelism Laboratory 36 Feb 16, 2023
A set of Zero Knowledge modules, written in Rust and designed to be used in other system programming environments.

Zerokit A set of Zero Knowledge modules, written in Rust and designed to be used in other system programming environments. Initial scope Focus on RLN

vac 44 Dec 27, 2022
Compile-time stuff and other goodies for rustaceans ๐Ÿฆ€

?? bagel: Always baked, never fried bagel is a collection of macros and other things that we frequently use at Skytable, primarily to get work done at

Skytable 3 Jul 4, 2022
rust channel benchmarks to keep stat of performance of Kanal library in comparison with other competitors.

Rust Channel Benchmarks This is a highly modified fork of the crossbeam-channel benchmarks. to keep track of Kanal library stats in comparison with ot

Khashayar Fereidani 14 Dec 21, 2022
Algebraic structures, higher-kinded types and other category theory bad ideas

Algar Algebric structures, higher-kinded types and other category theory bad ideas. Yes, you'll have generalized functors, applicatives, monads, trave

Stefano Candori 3 Jan 31, 2023
A mobile application platform for tertiary students to communicate, collaborate and share ideas with each other

Qreeket (pronounced "cricket") A mobile application platform for tertiary students to communicate, collaborate and share ideas with each other. As the

Quabynah Bilson Jr. 3 May 15, 2023
Rust library for compiling and running other programs.

Exers ?? Exers is a rust library for compiling and running code in different languages and runtimes. Usage example fn main() { // Imports...

olix3001 5 Jun 10, 2023
A repository for showcasing my knowledge of the Rust programming language, and continuing to learn the language.

Learning Rust I started learning the Rust programming language before using GitHub, but increased its usage afterwards. I have found it to be a fast a

Sean P. Myrick V19.1.7.2 2 Nov 8, 2022
Nyah is a programming language runtime built for high performance and comes with a scripting language.

?? Nyah ( Unfinished ) Nyah is a programming language runtime built for high performance and comes with a scripting language. ??๏ธ Status Nyah is not c

Stacker 3 Mar 6, 2022
Mewl, program in cats' language; A just-for-fun language

Mewl The programming language of cats' with the taste of lisp ?? What,Why? Well, 2 years ago in 2020, I created a esoteric programming language called

Palash Bauri 14 Oct 23, 2022
lelang programming language is a toy language based on LLVM.

lelang leangๆ˜ฏไธ€้—จไฝฟ็”จRust็ผ–ๅ†™๏ผŒๅŸบไบŽLLVM(inkwell llvm safe binding library)ๅฎž็Žฐ็š„็ผ–็จ‹่ฏญ่จ€๏ผŒ่ตทๅˆไฝœไธบ่ฏพ็จ‹ๅฎž้ชŒ้กน็›ฎ๏ผŒ็Žฐๅœจไธบไธชไบบ้•ฟๆœŸ็ปดๆŠค้กน็›ฎใ€‚ Target Features ๆ”ฏๆŒ8่‡ณ64ไฝ็š„ๆ•ดๅฝข็ฑปๅž‹ๅ’Œ32/64ไฝๆตฎ็‚น ๅŸบๆœฌ็š„ๅ‡ฝๆ•ฐๅฎšไน‰๏ผŒ่ฐƒ็”จ๏ผŒๅฃฐๆ˜Žๅค–้ƒจ

Aya0wind 5 Sep 4, 2022
The Devils' Programming Language (Quantum Programming Language)

devilslang has roots in Scheme and ML-flavored languages: it's the culmination of everything I expect from a programming language, including the desire to keep everything as minimalistic and concise as possible. At its core, devilslang is lambda-calculus with pattern-matching, structural types, fiber-based concurrency, and syntactic extension.

Devils' Language 2 Aug 26, 2022
The Computer Language Benchmarks Game: Rust implementations

The Computer Language Benchmarks Game: Rust implementations This is the version I propose to the The Computer Language Benchmarks Game. For regex-dna,

Guillaume P. 69 Jul 11, 2022
A community curated list of Rust Language streamers

Awesome Rust Streaming This is a community curated list of livestreams about the programming language Rust. Don't see a stream that you like? Feel fre

James Munns 587 Dec 26, 2022
Core Temporal SDK that can be used as a base for language specific Temporal SDKs

Core SDK that can be used as a base for all other Temporal SDKs. Getting started See the Architecture doc for some high-level information. This repo u

temporal.io 136 Dec 21, 2022