diff --git a/_posts/2024-04-15-gleam-v1.1.md b/_posts/2024-04-15-gleam-v1.1.md deleted file mode 100644 index 69a6f691..00000000 --- a/_posts/2024-04-15-gleam-v1.1.md +++ /dev/null @@ -1,523 +0,0 @@ ---- -author: Louis Pilfold -author-link: https://github.com/lpil -title: Gleam version v1.1 -subtitle: Hot on the heels of v1 -tags: - - Release ---- - -Gleam is a type safe and scalable language for the Erlang virtual machine and -JavaScript runtimes. Today Gleam [v1.0.0][release] has been published, just a -month after v1.0.0. There's loads of new stuff in this release, so take a look -at what's new! - - -## Bun support -- Added support for the [Bun](https://bun.sh/) runtime when compiling to - JavaScript by using `gleam run --target javascript --runtime bun` - - -## Clearer dependency requirements -- The `~> x.y` version constraint syntax has been dropped in favour of - `> x.y.z and <= xx.0.0` syntax in `gleam add` and `gleam new`, for clarity. - - -## Autocomplete imports -- Completions are now provided for module imports. - -## Global todo definition -- Go to definition now works for values in dependency Gleam modules. - - -- The formatter can now format groups of imports alphabetically. -- Line endings other than `\n` are now handled by the formatter, preserving - blank lines and converting them to `\n`. - -## JavaScript list optimistion -- Prepending to lists in JavaScript (`[x, ..xs]` syntax) has been optimised. - - - - - - - - -## Better package validation - -Gleam uses Hex, the package manager for the BEAM ecosystem. Since v1.0.0 the -number of Gleam packages has really taken off, [new ones being published every -day](https://packages.gleam.run/). - -We don't just want a large number of packages, we also want to ensure that -Gleam packages are as high quality as possible. With this release we have some -more things that we will be checking packages for before publishing, to catch -common mistakes. - -The `gleam.toml` project file includes the location of the source code -repository for the package. Sometimes folks would make typos or forget to make -the repository public, making the documentation's links there unusable. When -publishing Gleam will now make a request to this URL to ensure it loads -successfully. - -Gleam has _internal_ modules, types, and values, which are only to be used by -the package they are defined in. If a package accidentally exposes an internal -type in the public API is can be an annoyance for users of that package as they -are undocumented and hard to use. Gleam now ensures that internal types are not -leaked when publishing. - -The Hex package manager has rules against name squatting, and empty packages -published to reserve a name may be removed. Gleam now checks to make sure that -blank packages are not published, and warns the publisher this is against the -Hex terms of service. - - - - - - - - - - - -## Potato friendly language server -- Update messages from the client are now batched to avoid doing excess - compilation work in the language server, improving performance. This makes a - large difference in low power machines where the language server could - struggle to keep up with the edits from the client. - - - - - -### Compiler - -- Fixed a bug where `tuple.0.1` was not recognised as a nested tuple access - expression -- Function stubs are no longer generated for functions that do not have an - implementation for the current targeting being compiled for. -- Improved error message when erroneously trying to append items to a list using - the spread syntax (like `[..rest, last]`). -- Generate [type references](https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-types-) - when compiling to JavaScript with TypeScript definitions enabled. -- Error messages are more clear about expecting values instead of types. - -### Build tool - -- Improve error message when using incorrect quotes (`'`) to define a string -- Improved error messages when failing to parse a series of things. -- A warning is now raised for unused binary operations, records, record access - and record updates. -- A warning is now raised when an internal type is accidentally exposed in a - package's public API. -- A warning is now emitted if there is a `.gleam` file with a path that would be - invalid as a module name. -- Dependencies that use Erlang-only bit options can now compile on JavaScript, - though the functions that use them will not be available for use in the root - package. -- Generated HTML documentation now includes a link to the package on Hex. -- Terminal colors can now be forced by setting the `FORCE_COLOR` environment - variable to any non-empty value. -- Update Deno config to allow passing `--location` runtime flag. -- Fixed a bug with dependency resolution of exact versions of RC releases. -- `gleam publish` can now optionally use a Hex API key to authorise publishing - and retiring packages, set via the environment variable `HEXPM_API_KEY`. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -## What's Gleam? - -Gleam is a programming language that tries to make your job as a writer and -maintainer of software systems as predictable, stress-free, and enjoyable as -possible. - -The language is consistent and has a small surface area, making it possible to -[learn in an afternoon][tour]. Coupled with a lack of magic and a strong desire -to have only one way of doing things, Gleam is typically easy to read and -understand. Reading and debugging code is more difficult than writing new code, -so we optimise for this. - -[tour]: https://tour.gleam.run/ - -Gleam has robust static analysis and a type system inspired by languages such as -Elm, OCaml, and Rust, so the compiler serves as a programming assistant, giving -you additional context to help you make the change you want to make. Don't worry -about writing perfect code the first time round, with Gleam refactoring is low -risk and low stress so you can continue to improve your code as you learn more -about the problem at hand. - -Running and administrating software is as important as writing it. Gleam -runs on the Erlang virtual machine, a mature and battle-tested platform that -powers many of the world's most reliable and scalable systems, such as WhatsApp. -Gleam can also run on JavaScript runtimes, making it possible to run Gleam code -in the browser, on mobile devices, or anywhere else. - -Gleam looks like this: -```gleam -import gleam/json -import gleam/result.{try} -import my_app/person -import wisp.{type Request, type Response} - -pub fn handle_request(req: Request, ctx: Context) -> Response { - use json <- wisp.require_json(req) - - let result = { - use data <- try(person.decode(json)) - use row <- try(person.insert(ctx.db, data)) - Ok(person.to_json(row)) - } - - case result { - Ok(json) -> wisp.json_response(json, 201) - Error(_) -> wisp.unprocessable_entity() - } -} -``` - - -## What does Gleam v1 include? - -This version covers all the public APIs found in [the main Gleam git -repository][repo], that is: - -- The Gleam language design. -- The Gleam compiler. -- The Gleam build tool. -- The Gleam package manager. -- The Gleam code formatter. -- The Gleam language server. -- The Gleam compiler WASM API and JavaScript bindings. - -[repo]: https://github.com/gleam-lang/gleam - -The Gleam standard library and other packages maintained by the core team will -be getting an accompanying v1 release shortly afterwards. Before these are -released we will be making pull requests to popular community packages to relax -their package manager version constraints to ensure that the update to v1 is as -smooth as possible for all Gleam users. - - -## What does v1 mean? - -Version 1 is a statement about Gleam's stability and readiness to be used in -production systems. We believe Gleam is suitable for use in projects that -matter, and Gleam will provide a stable and predictable foundation. - -Gleam follows [semantic versioning][semver], so maintaining backwards -compatibility is now a priority. We will be making every effort to ensure that -Gleam does not introduce breaking changes. The exception to this is for security -and soundness issues. Should a critical bug of this nature be discovered we -reserve the right to fix the security issue, even if some programs were taking -advantage of the bug. - -[semver]: https://semver.org/ - - -## What's next for Gleam? - -Gleam is a practical language intended for making real things, so our focus for -Gleam post-v1 is to be split between productivity for Gleam users and -sustainability for the Gleam project. - - -### Productivity for Gleam users - -As well as not introducing breaking changes we will also be avoiding language -bloat. It's easy to keep adding new features to a language to aid with specific -problems, but with each new language feature or new way of solving a problem the -language as a whole becomes more complex and harder to understand. -Simplicity is a feature in Gleam and that will not change going forward. -There is scope adding new features to the language, but we will be doing so -extremely conservatively. Any new feature has to be generally useful and enable -new things not otherwise possible in Gleam, while being a worthwhile trade -for the added complexity it brings to the language. - -Rather than adding new features to the language we will be continuously -improving the Gleam developer experience and enhancing real-world productivity. -Initially the focus will be on improving the Gleam language server as it is -immature compared to the rest of the Gleam tooling. We will also be working on -all the libraries and such that folks will likely want when making production -systems in Gleam, with an initial focus on development of websites and web -services. - -Documentation is also a priority. We want to have tutorials and guides for all -manner of tasks in Gleam. It should always be easy to find how to do something -in Gleam, so you can focus on achieving your goal. - - -### Sustainability for the Gleam project - -Gleam is not a project from Microsoft or Google, it's a community project. There -is one full-time developer working on Gleam (me!) and a number of part time -volunteers who do excellent work. With this small team we need to be efficient -with our efforts. Anything we work on needs to be impactful and meaningful to -the whole Gleam community, we cannot afford to spend time on niche or -unimportant situations. - -Internal documentation is also important. As an open source project we want -folks to be able to open up the codebase and make their contribution as easily -as possible. So far the feedback has been that the Gleam compiler and build tool -are easy to contribute to. This is encouraging, and we will continue to work on -this to ensure that the Gleam project never gets to a point where only a select -few people are able to meaningfully contribute to its maintenance. - -The last part of sustainability is financial. - -I am able to afford to work on Gleam full time thanks to the support of the -project's sponsors on [GitHub Sponsors][sponsors]. The largest contributor is -[Fly.io](https://fly.io), who provide approximately half the funding. Thank you -Fly.io! We wouldn't be here today without your support! - -[sponsors]: https://github.com/sponsors/lpil - -Going forward I would like to diversify the funding with more corporate -sponsors, as well as other revenue streams. I earn less than half of what I -would make with the median lead developer salary in London, the city in which I -live. This is enough money for me to get by, but I would very much like to earn -around what I would if I had some other job. - -Long term I would like to be able to financially reward the regular contributors -to Gleam. The folks in the core team are wonderfully talented and they should be -rewarded appropriately for their work. - - -Lucy, Gleam's cute pink starfish mascot - -## Hello, Lucy! - -Gleam's mascot, Lucy, has had little bit of a glow-up! 💖 - - -Lucy's a kind and friendly little starfish who enjoys strawberry ice cream and -functional programming. The rest of Lucy's story is up to the community to tell. -Thank you to [suppyluppy](https://github.com/suppyluppy) for this wonderful -redesign and for starting Lucy's canon. - -To go with Lucy's new look we've also snazzied up the website up a little and -adjusted the colours for legibility. We hope you like it! - -Right, that's everything! Thank you to all the fantastic people who have made -this v1.0.0 release possible through sponsorship or code contributions: - - - - - [Aaron Gunderson](https://github.com/agundy) - - [Adam Brodzinski](https://github.com/AdamBrodzinski) - - [Adam Mokan](https://github.com/amokan) - - [Adi Iyengar](https://github.com/thebugcatcher) - - [Alembic](https://alembic.com.au) - - [Alex Manning](https://github.com/rawhat) - - [Alexander Koutmos](https://github.com/akoutmos) - - [Alexander Stensrud](https://github.com/spektroskop) - - [Alexandre Del Vecchio](https://github.com/defgenx) - - [Andrea Tupini](https://github.com/tupini07) - - [Andy Aylward](https://github.com/aaylward) - - [Anthony Khong](https://github.com/anthony-khong) - - [Anthony Scotti](https://github.com/amscotti) - - [Arnaud Berthomier](https://github.com/oz) - - [Ayodeji O](https://github.com/aosasona) - - [Barry Moore](https://github.com/chiroptical) - - [Ben Marx](https://github.com/bgmarx) - - [Ben Myles](https://github.com/benmyles) - - [Benjamin Peinhardt](https://github.com/bcpeinhardt) - - [Benjamin Thomas](https://github.com/bentomas) - - [brettkolodny](https://github.com/brettkolodny) - - [Brian Glusman](https://github.com/bglusman) - - [Brian Kung](https://github.com/briankung) - - [Bruno Michel](https://github.com/nono) - - [Carlos Saltos](https://github.com/csaltos) - - [Chew Choon Keat](https://github.com/choonkeat) - - [Chris Lloyd](https://github.com/chrislloyd) - - [Chris Ohk](https://github.com/utilForever) - - [Chris Rybicki](https://github.com/Chriscbr) - - [Christopher Dieringer](https://github.com/cdaringe) - - [Christopher Keele](https://github.com/christhekeele) - - [clangley](https://github.com/clangley) - - [Clay](https://github.com/connorlay) - - [Coder](https://github.com/coder) - - [Cole Lawrence](https://github.com/colelawrence) - - [Colin](https://github.com/insanitybit) - - [Cristine Guadelupe](https://github.com/cristineguadelupe) - - [Damir Vandic](https://github.com/dvic) - - [Dan Dresselhaus](https://github.com/ddresselhaus) - - [Daniel Sherlock](https://github.com/DanielSherlock) - - [Danielle Maywood](https://github.com/DanielleMaywood) - - [Danny Martini](https://github.com/despairblue) - - [Dave Lucia](https://github.com/davydog187) - - [David Bernheisel](https://github.com/dbernheisel) - - [David Flanagan](https://github.com/rawkode) - - [David Sancho](https://github.com/davesnx) - - [Dennis Dang](https://github.com/dangdennis) - - [Devon Sawatsky](https://github.com/novedevo) - - [Dillon Mulroy](https://github.com/dmmulroy) - - [Dmitry Poroh](https://github.com/poroh) - - [Douglas M](https://github.com/Massolari) - - [Edon Gashi](https://github.com/edongashi) - - [Elliott Pogue](https://github.com/epogue) - - [Emma](https://github.com/Emma-Fuller) - - [Erik Terpstra](https://github.com/eterps) - - [Ernesto Malave](https://github.com/oberernst) - - [F. Schwalbe](https://github.com/fschwalbe) - - [Fernando Farias](https://github.com/nandofarias) - - [Filip Figiel](https://github.com/ffigiel) - - [Florian Kraft](https://github.com/floriank) - - [fly.io](https://github.com/superfly) - - [Frédéric Boyer](https://github.com/fredericboyer) - - [ggobbe](https://github.com/ggobbe) - - [Giacomo Cavalieri](https://github.com/giacomocavalieri) - - [Graeme Coupar](https://github.com/obmarg) - - [Guilherme de Maio](https://github.com/nirev) - - [Gustavo Villa](https://github.com/gfvcastro) - - [Hayleigh Thompson](https://github.com/hayleigh-dot-dev) - - [Hazel Bachrach](https://github.com/hibachrach) - - [Henry Warren](https://github.com/henrysdev) - - [Hex](https://github.com/hexpm) - - [human154](https://github.com/human154) - - [Ian González](https://github.com/Ian-GL) - - [Igor Rumiha](https://github.com/irumiha) - - [inoas](https://github.com/inoas) - - [Ivar Vong](https://github.com/ivarvong) - - [James Birtles](https://github.com/jamesbirtles) - - [James MacAulay](https://github.com/jamesmacaulay) - - [Jan Skriver Sørensen](https://github.com/monzool) - - [Jen Stehlik](https://github.com/okkdev) - - [jiangplus](https://github.com/jiangplus) - - [Joey Kilpatrick](https://github.com/joeykilpatrick) - - [John Björk](https://github.com/JohnBjrk) - - [Jonas Hedman Engström](https://github.com/JonasHedEng) - - [Josef Richter](https://github.com/josefrichter) - - [Joseph T. Lyons](https://github.com/JosephTLyons) - - [Julian Schurhammer](https://github.com/schurhammer) - - [Kieran Gill](https://github.com/kierangilliam) - - [kodumbeats](https://github.com/kodumbeats) - - [Kryštof Řezáč](https://github.com/krystofrezac) - - [Lars Wikman](https://github.com/lawik) - - [Leon Qadirie](https://github.com/leonqadirie) - - [LighghtEeloo](https://github.com/LighghtEeloo) - - [Linda Vitali](https://github.com/vitlinda) - - [Manuel Rubio](https://github.com/manuel-rubio) - - [Marcøs](https://github.com/ideaMarcos) - - [Mario Flach](https://github.com/redrabbit) - - [Marius Kalvø](https://github.com/mariuskalvo) - - [Mark Holmes](https://github.com/markholmes) - - [Mark Markaryan](https://github.com/markmark206) - - [Markus](https://github.com/markusfeyh) - - [Martin Janiczek](https://github.com/Janiczek) - - [Matt Savoia](https://github.com/matt-savvy) - - [Matt Van Horn](https://github.com/mattvanhorn) - - [Matthias Benkort](https://github.com/KtorZ) - - [max-tern](https://github.com/max-tern) - - [Michael Davis](https://github.com/the-mikedavis) - - [Michael Duffy](https://github.com/stunthamster) - - [Michael Jones](https://github.com/michaeljones) - - [Mike Roach](https://github.com/mroach) - - [MystPi](https://github.com/MystPi) - - [Natanael Sirqueira](https://github.com/natanaelsirqueira) - - [Nathaniel Knight](https://github.com/nathanielknight) - - [NFIBrokerage](https://github.com/NFIBrokerage) - - [Nick Reynolds](https://github.com/ndreynolds) - - [Nicklas Sindlev Andersen](https://github.com/NicklasXYZ) - - [NineFX](http://www.ninefx.com) - - [Noah Betzen](https://github.com/Nezteb) - - [Ocean Armstrong Lewis](https://github.com/oceanlewis) - - [OldhamMade](https://github.com/OldhamMade) - - [Ole Michaelis](https://github.com/OleMchls) - - [Paul Gideon Dann](https://github.com/giddie) - - [Paul Guse](https://github.com/pguse) - - [Pete Jodo](https://github.com/petejodo) - - [Philip Giuliani](https://github.com/philipgiuliani) - - [Prashant Singh Pawar](https://github.com/prashantpawar) - - [qingliangcn](https://github.com/qingliangcn) - - [Raúl Chouza ](https://github.com/chouzar) - - [Redmar Kerkhoff](https://github.com/redmar) - - [Richard Viney](https://github.com/richard-viney) - - [Rico Leuthold](https://github.com/rico) - - [Robert Attard](https://github.com/TanklesXL) - - [Robert Ellen](https://github.com/rellen) - - [Sam Aaron](https://github.com/samaaron) - - [Sammy Isseyegh](https://github.com/bkspace) - - [Saša Jurić](https://github.com/sasa1977) - - [Scott Bowles](https://github.com/scottBowles) - - [Scott Wey](https://github.com/scottwey) - - [Sean Jensen-Grey](https://github.com/seanjensengrey) - - [Sebastian Porto](https://github.com/sporto) - - [sekun](https://github.com/sekunho) - - [Seve Salazar](https://github.com/tehprofessor) - - [Shuqian Hon](https://github.com/honsq90) - - [Signal Insights](https://github.com/signalinsights) - - [Simon Johansson](https://github.com/DrPhil) - - [Simone Vittori](https://github.com/simonewebdesign) - - [Szymon Wygnański](https://github.com/finalclass) - - [Thanabodee Charoenpiriyakij](https://github.com/wingyplus) - - [Theo Harris](https://github.com/Theosaurus-Rex) - - [Timo Sulg](https://github.com/timgluz) - - [Tom Kenny](https://github.com/twome) - - [Tomasz Kowal](https://github.com/tomekowal) - - [Tristan de Cacqueray](https://github.com/TristanCacqueray) - - [Tristan Sloughter](https://github.com/tsloughter) - - [tynanbe](https://github.com/tynanbe) - - [Volker Rabe](https://github.com/yelps) - - [Weizheng Liu](https://github.com/weizhliu) - - [Wesley Moore](https://github.com/wezm) - - [Willyboar](https://github.com/Willyboar) - - [Wilson Silva](https://github.com/wilsonsilva) - - [xhh](https://github.com/xhh) - - [Yasuo Higano](https://github.com/Yasuo-Higano) - - [Yu Matsuzawa](https://github.com/ymtszw) - - [Zsombor Gasparin](https://github.com/gasparinzsombor) - - [Šárka Slavětínská](https://github.com/sarkasl) - -Thanks for reading, and I hope you enjoy Gleam v1 💜 - -
- Try Gleam -
- - diff --git a/_posts/2024-04-16-gleam-v1.1.md b/_posts/2024-04-16-gleam-v1.1.md new file mode 100644 index 00000000..a73635f5 --- /dev/null +++ b/_posts/2024-04-16-gleam-v1.1.md @@ -0,0 +1,567 @@ +--- +author: Louis Pilfold +author-link: https://github.com/lpil +title: Gleam version v1.1 +subtitle: Hot on the heels of v1 +tags: + - Release +--- + +Gleam is a type safe and scalable language for the Erlang virtual machine and +JavaScript runtimes. Today Gleam [v1.1.0][release] has been published, just a +month after v1.0.0. There's loads of new stuff in this release, so take a look +at some of what's new! + +[release]: https://github.com/gleam-lang/gleam/releases/tag/v1.1.0 + + +## Language server improvements + +Productivity and developer experience is a first class concern to us, and in a +modern language good editor support is an important part of the puzzle. To help +Gleam has a built-in language server which is developed and maintained by the +core team. The language server is relatively immature compared to the rest of +the language's tooling, and it is one of the main focuses for core development +at the moment. + +It has been improved in these ways: + +### Compilation batching + +The language server is driven by messages sent by your editor each time a file +is opened, code is edited, autocompletions are needed, and so on. When messages +are received the language server runs the compiler (minus the codegen sections) +to get information about the code. + +The language server now batches theses messages intelligently, compiling when is +required rather than on every message. For example, if your editor rapidly sends +several text edits and then a request for refactorings the language server will +now apply all the edits to its in-memory filesystem overlay before compiling a +single time. If you are using a faster computer you likely will see no +difference, but if you're using a slower computer or in a very large project +you'll no longer experience a delay before getting feedback from the language +server. + +### Autocomplete imports + +The language server will now autocomplete module names when writing import +statements. Thank you [Ameen Radwan](https://github.com/Acepie) for this improvement! + +Neovim showing imports being autocompleted + +### Global todo definition + +Gleam's language server previously supported go-to definition for values defined +in the top-level package, but with this release it also works for values defined +in dependency packages too. Thank you [Ameen Radwan](https://github.com/Acepie) again! + +## Bun support + +Gleam compiles to JavaScript as well as Erlang, and there are multiple popular +options for running JavaScript code on the command line. Gleam supports the +NodeJS and Deno runtimes, and with v1.1.0 Bun support has been added too! + +To use Bun either add `javascript.runtime` key to your `gleam.toml`, or add +the `--runtime=bun` flag to your `gleam run` or `gleam test` command. + +```toml +name = "app" +version = "1.0.0" +target = "javascript" + +[javascript] +runtime = "bun" +``` + +Thank you [gubsey](https://github.com/gubsey) for this feature. + +## Rebar support + +Rebar3 is the standard Erlang build tool but some projects use the older built +tool rebar (without the 3). Rebar3 has some amount of backwards compatibility +with rebar and can build a typical rebar project, so with this release Gleam +will now use rebar3 to build any rebar packages added as dependencies. This is +enough to use all rebar packages we've found on the package manager so far. + +Thank you [Isaac Harris-Holt](https://github.com/isaacharrisholt) for this feature! + +## Formatter improvements + +[Giacomo Cavalieri](https://github.com/giacomocavalieri) the pretty-printing +wizard has been hard at work improving the formatter and fixing bugs. One +highlight is that the formatter will now sort groups of imports into +alphabetical order automatically. + +[Juho Eerola](https://github.com/juntuu) also improved support for non-`\n` +newlines to the formatter, causing them to be converted to `\n` rather than +discarding them, which previously resulted in some empty lines being removed. + +## Clearer dependency requirements + +Gleam uses the Hex package manager, and Hex specifies a syntax for version +constraints. The syntax `~> 1.0`, which means `>= 1.0.0 and < +2.0.0`, and Gleam would use this in your `gleam.toml` when adding a dependency +with `gleam add`. + +This syntax was very commonly misunderstood by people, and often would be +confused for the `~> 1.0.0` syntax, which looks very similar but does something +different and undesirable. To avoid this repeated confusion the longer and +easier to understand syntax is now used instead. + +## JavaScript list optimistion + +[Julian Schurhammer](https://github.com/schurhammer) identified and implemented +an optimisation for prepending to a list on the JavaScript target. List +prepending is extremely common in Gleam, so optimisations here have a big +impact. Once applied running the standard library test suite went from ~3.0 +seconds to ~2.4 seconds. Thank you Julian! + +```sh +# before + +2.98s user 0.37s system 135% cpu 2.471 total +2.85s user 0.37s system 133% cpu 2.409 total +3.00s user 0.39s system 134% cpu 2.516 total + +# after + +2.37s user 0.35s system 132% cpu 2.048 total +2.33s user 0.37s system 134% cpu 2.009 total +2.38s user 0.36s system 134% cpu 2.034 total +``` + +## Internal types and values + +Gleam has a concept of _internal modules_, which are modules that are only to be +used from within the same package. With is release the `@internal` attribute can +be used to make a type or value internal in a module that is otherwise +not-internal. This may be helpful for exposing functionality so that it can be +directly tested, while not making it part of the package's public API. + + +Thank you [Giacomo Cavalieri](https://github.com/giacomocavalieri) for this feature! + +## Dead code elimination + +Gleam packages can be cross-target and work on both Erlang and JavaScript. +These packages may have target specific dependencies which are only used on one +target or the other. + +The compiler now performs more aggressive dead-code elimination and will remove +any code that is unreachable for the target that is currently being used. + +## Better package validation + +Since v1.0.0 the number of Gleam packages has really taken off, [new ones being +published every day](https://packages.gleam.run/). + +We don't just want a healthy number of packages, we also want to ensure that +Gleam packages are as high quality as possible. With this release we have some +more things that we will be checking packages for before publishing, to catch +common mistakes. + +The `gleam.toml` project file includes the location of the source code +repository for the package. Sometimes folks would make typos or forget to make +the repository public, making the documentation's links there unusable. When +publishing Gleam will now make a request to this URL to ensure it loads +successfully. + +The Hex package manager has rules against name squatting, and empty packages +published to reserve a name may be removed. Gleam now checks to make sure that +blank packages are not published, and warns the publisher this is against the +Hex terms of service. + +## Improved diagnostics + +Gleam's warnings and errors try to be as helpful as possible, hopefully making +it clear how your code can be improved. Several improved error messages and new +warnings have been added: + +A `case` expression in Gleam can pattern match on multiple subjects at once. +Folks not be aware of this an may instead wrap multiple values in a redundant +tuple as would be required in some other language. This now causes a warning to +be emitted: + +An error about a tuple being redundant + +In a future release the language server will have a code-action to remove this +for you. + +Another new warning is this one that is emitted when a literal expression or a +side-effect free expression is not used. This helps the programmer catch dead +code, and possibly also identify problems such as the missing `<>` in the +example here: + +A warning about an unusued value + +And lastly, an example of an improved error. One mistake people unfamiliar with +immutable linked lists might make is to attempt to append to a list using the +list syntax. This syntax only works for prepending as prepending is fast, while +appending is slow. + +An error explaining why a spread is invalid + +Thank you [Giacomo Cavalieri](https://github.com/giacomocavalieri) for these improvements! + +## Improved tuple parsing + +Tuples can be indexed into using the `.0`, `.1`, `.2`, etc syntax, but with +previous versions of the parser indexing into nested tuples like `tuple.0.2` +would not parse successfully. Thank you to [Nikita Sobolev](https://github.com/sobolevn) +for fixing this problem! + +## And the rest + +That's enough for this post, but there's lots more. If you'd like to see all the +changes for this release check out [the changelog](https://github.com/gleam-lang/gleam/blob/main/CHANGELOG.md#v110---2024-04-16) +in the git repository. + +## Thanks + +Gleam is made possible by the support of all the kind people and companies who have +very generously [**sponsored**](https://github.com/sponsors/lpil) or +contributed to the project. Thank you all! + +If you like Gleam consider sponsoring or asking your employer to +[sponsor Gleam development](https://github.com/sponsors/lpil). I work full time +on Gleam and your kind sponsorship is how I pay my bills! + + + + - [0fie](https://github.com/0fie) + - [0riginaln0](https://github.com/0riginaln0) + - [Aaron Gunderson](https://github.com/agundy) + - [Abdulrhman Alkhodiry](https://github.com/zeroows) + - [ad-ops](https://github.com/ad-ops) + - [Adam Brodzinski](https://github.com/AdamBrodzinski) + - [Adam Johnston](https://github.com/adjohnston) + - [Adi Iyengar](https://github.com/thebugcatcher) + - [Aiden Fox Ivey](https://github.com/aidenfoxivey) + - [Airradda](https://github.com/Airradda) + - [Ajit Krishna](https://github.com/JitPackJoyride) + - [aldrin-ronco](https://github.com/aldrin-ronco) + - [Alembic](https://alembic.com.au) + - [Alex Manning](https://github.com/rawhat) + - [Alexander Koutmos](https://github.com/akoutmos) + - [Alexander Stensrud](https://github.com/spektroskop) + - [Alexandre Del Vecchio](https://github.com/defgenx) + - [Alivy](https://github.com/Aephn) + - [Ameen Radwan](https://github.com/Acepie) + - [AndreHogberg](https://github.com/AndreHogberg) + - [Andrew Kachnic](https://github.com/ajkachnic) + - [André Mazoni](https://github.com/andremw) + - [Andy Aylward](https://github.com/aaylward) + - [Anthony Bullard](https://github.com/gamebox) + - [Anthony Khong](https://github.com/anthony-khong) + - [Anthony Scotti](https://github.com/amscotti) + - [Arnaud Berthomier](https://github.com/oz) + - [Arnav K](https://github.com/ArnavK-09) + - [Artem Solomatin](https://github.com/solar05) + - [Arthur Weagel](https://github.com/aweagel) + - [Austin Miller](https://github.com/apmwebdev) + - [Avraam "Makis" Marimpis](https://github.com/makism) + - [Barry Moore](https://github.com/chiroptical) + - [Ben Marx](https://github.com/bgmarx) + - [Ben Myles](https://github.com/benmyles) + - [Benjamin Peinhardt](https://github.com/bcpeinhardt) + - [Benjamin Thomas](https://github.com/bentomas) + - [Bill Nunney](https://github.com/bigtallbill) + - [Brad Lewis](https://github.com/BradLewis) + - [Bram Vanbilsen](https://github.com/bramvbilsen) + - [Brett Cannon](https://github.com/brettcannon) + - [brettkolodny](https://github.com/brettkolodny) + - [Brian Corbin](https://github.com/briancorbinxyz) + - [Brian Dawn](https://github.com/brian-dawn) + - [Brian Glusman](https://github.com/bglusman) + - [Bruno Michel](https://github.com/nono) + - [bucsi](https://github.com/bucsi) + - [bwireman](https://github.com/bwireman) + - [Carlo Munguia](https://github.com/carlomunguia) + - [Carlos Saltos](https://github.com/csaltos) + - [catapillie](https://github.com/catapillie) + - [Chad Selph](https://github.com/chadselph) + - [Charlie Govea](https://github.com/charlie-n01r) + - [Chaz Watkins](https://github.com/chazwatkins) + - [Chen Tao](https://github.com/jagt) + - [Chew Choon Keat](https://github.com/choonkeat) + - [Chris Birster](https://github.com/chrisbirster) + - [Chris Donnelly](https://github.com/ceedon) + - [Chris King](https://github.com/Morzaram) + - [Chris Lloyd](https://github.com/chrislloyd) + - [Chris Ohk](https://github.com/utilForever) + - [Chris Rybicki](https://github.com/Chriscbr) + - [Christopher Dieringer](https://github.com/cdaringe) + - [Christopher Keele](https://github.com/christhekeele) + - [clangley](https://github.com/clangley) + - [Clay](https://github.com/connorlay) + - [Cleo](https://github.com/Lucostus) + - [CodeCrafters](https://github.com/codecrafters-io) + - [Coder](https://github.com/coder) + - [Cole Lawrence](https://github.com/colelawrence) + - [Colin](https://github.com/insanitybit) + - [Comamoca](https://github.com/Comamoca) + - [Cristine Guadelupe](https://github.com/cristineguadelupe) + - [Damir Vandic](https://github.com/dvic) + - [Dan Dresselhaus](https://github.com/ddresselhaus) + - [Daniel](https://github.com/danielelli) + - [Danielle Maywood](https://github.com/DanielleMaywood) + - [Danik Vitek](https://github.com/DanikVitek) + - [Danny Arnold](https://github.com/pinnet) + - [Danny Martini](https://github.com/despairblue) + - [darenc](https://github.com/darenc) + - [Darshak Parikh](https://github.com/dar5hak) + - [Dave Lucia](https://github.com/davydog187) + - [David Bernheisel](https://github.com/dbernheisel) + - [David Flanagan](https://github.com/rawkode) + - [David Legrand](https://github.com/davlgd) + - [David Sancho](https://github.com/davesnx) + - [Dennis Dang](https://github.com/dangdennis) + - [dennistruemper](https://github.com/dennistruemper) + - [dependabot[bot]](https://github.com/dependabot%5Bbot%5D) + - [desk7](https://github.com/desk7) + - [Dezhi Wu](https://github.com/dzvon) + - [Dhuds1](https://github.com/Dhuds1) + - [Dillon Mulroy](https://github.com/dmmulroy) + - [Dimitrii Dulgher](https://github.com/dtln820) + - [Divya Jain](https://github.com/dvjn) + - [Dmitry Poroh](https://github.com/poroh) + - [Dmytro Utkin](https://github.com/gothy) + - [domnantas](https://github.com/domnantas) + - [ds2600](https://github.com/ds2600) + - [Edon Gashi](https://github.com/edongashi) + - [eli](https://github.com/dropwhile) + - [Elie Labeca](https://github.com/elabeca) + - [Elliott Pogue](https://github.com/epogue) + - [Emma](https://github.com/Emma-Fuller) + - [EMR Technical Solutions](https://github.com/EMRTS) + - [Endercheif](https://github.com/Enderchief) + - [Erik Lilja](https://github.com/Lilja) + - [Erik Terpstra](https://github.com/eterps) + - [ErikML](https://github.com/ErikML) + - [Ernesto Malave](https://github.com/oberernst) + - [F. Schwalbe](https://github.com/fschwalbe) + - [Felix Mayer](https://github.com/yerTools) + - [Fernando Farias](https://github.com/nandofarias) + - [Filip Figiel](https://github.com/ffigiel) + - [Fionn Langhans](https://github.com/codefionn) + - [fitv](https://github.com/fitv) + - [Florian Kraft](https://github.com/floriank) + - [fly.io](https://github.com/superfly) + - [Georg H. Ekeberg](https://github.com/hagenek) + - [Giacomo Cavalieri](https://github.com/giacomocavalieri) + - [Graeme Coupar](https://github.com/obmarg) + - [grotto](https://github.com/grottohub) + - [gubsey](https://github.com/gubsey) + - [Guilherme de Maio](https://github.com/nirev) + - [Guillaume Hivert](https://github.com/ghivert) + - [Hamir Mahal](https://github.com/hamirmahal) + - [Hammad Javed](https://github.com/hammad-r-javed) + - [Hampus Kraft](https://github.com/hampuskraft) + - [Hannes Schnaitter](https://github.com/ildorn) + - [Hayes Hundman](https://github.com/jhundman) + - [Hayleigh Thompson](https://github.com/hayleigh-dot-dev) + - [Hazel Bachrach](https://github.com/hibachrach) + - [Henning Dahlheim](https://github.com/hdahlheim) + - [Henry Firth](https://github.com/h14h) + - [Henry Warren](https://github.com/henrysdev) + - [Hex](https://github.com/hexpm) + - [human154](https://github.com/human154) + - [Humberto Piaia](https://github.com/hpiaia) + - [Ian Gonzalez](https://github.com/Ian-GL) + - [Igor Rumiha](https://github.com/irumiha) + - [Ikko Eltociear Ashimine](https://github.com/eltociear) + - [inoas](https://github.com/inoas) + - [Isaac Adewumi](https://github.com/prettyirrelevant) + - [Isaac Harris-Holt](https://github.com/isaacharrisholt) + - [Ismael Abreu](https://github.com/ismaelga) + - [Ivar Vong](https://github.com/ivarvong) + - [Iztok Fister Jr](https://github.com/firefly-cpp) + - [J. Rinaldi](https://github.com/m-rinaldi) + - [Jacob Fenton](https://github.com/asib) + - [Jacob Lamb](https://github.com/jacobdalamb) + - [James Birtles](https://github.com/jamesbirtles) + - [James MacAulay](https://github.com/jamesmacaulay) + - [Jan Skriver Sørensen](https://github.com/monzool) + - [Jaxon Carelos](https://github.com/jaxoncarelos) + - [Jean-Luc Geering](https://github.com/jlgeering) + - [Jean-Nicolas Veigel](https://github.com/blksnk) + - [Jen Stehlik](https://github.com/okkdev) + - [jiangplus](https://github.com/jiangplus) + - [Jimpjorps™](https://github.com/hunkyjimpjorps) + - [Jiri Luzny](https://github.com/jluzny) + - [Joey Kilpatrick](https://github.com/joeykilpatrick) + - [Johan Strand](https://github.com/johan-st) + - [John Björk](https://github.com/JohnBjrk) + - [John Pavlick](https://github.com/jmpavlick) + - [Jonas Hedman Engström](https://github.com/JonasHedEng) + - [Josef Richter](https://github.com/josefrichter) + - [Josh](https://github.com/Joshswooft) + - [Josh Gillies](https://github.com/joshgillies) + - [Joshua Steele](https://github.com/joshocalico) + - [Juho Eerola](https://github.com/juntuu) + - [Julian Schurhammer](https://github.com/schurhammer) + - Kero van Gelder + - [Kieran Gill](https://github.com/kierangilliam) + - [kodumbeats](https://github.com/kodumbeats) + - [Kramer Hampton](https://github.com/hamptokr) + - [Kryštof Řezáč](https://github.com/krystofrezac) + - [Krzysztof G.](https://github.com/krzysztofgb) + - [Lars Wikman](https://github.com/lawik) + - [Larz Conwell](https://github.com/larzconwell) + - [Leandro Ostera](https://github.com/leostera) + - [Leon Qadirie](https://github.com/leonqadirie) + - [lidashuang](https://github.com/defp) + - [LighghtEeloo](https://github.com/LighghtEeloo) + - [Loïc Tosser](https://github.com/wowi42) + - [Lucian Petic](https://github.com/lpetic) + - [Léopold Hubert](https://github.com/leopoldhub) + - [Manuel Jesús de la Fuente](https://github.com/Manueljlin) + - [Manuel Rubio](https://github.com/manuel-rubio) + - [Marcøs](https://github.com/ideaMarcos) + - [Mariano Uvalle](https://github.com/AYM1607) + - [Marius Kalvø](https://github.com/mariuskalvo) + - [Mark Holmes](https://github.com/markholmes) + - [Mark Jaquith](https://github.com/markjaquith) + - [Mark Markaryan](https://github.com/markmark206) + - [Marshall Bowers](https://github.com/maxdeviant) + - [Martin Janiczek](https://github.com/Janiczek) + - [Martin Rechsteiner](https://github.com/rechsteiner) + - [Matt Champagne](https://github.com/han-tyumi) + - [Matt Savoia](https://github.com/matt-savvy) + - [Matt Van Horn](https://github.com/mattvanhorn) + - [Matthias Benkort](https://github.com/KtorZ) + - [Max](https://github.com/maxwell-kalin) + - [Max McDonnell](https://github.com/maxmcd) + - [max-tern](https://github.com/max-tern) + - [Maxime Bouillot](https://github.com/Arkaeriit) + - [Michael Davis](https://github.com/the-mikedavis) + - [Michael Duffy](https://github.com/stunthamster) + - [Michael Jones](https://github.com/michaeljones) + - [Michael Kieran O'Reilly](https://github.com/SoTeKie) + - [Michael Kumm](https://github.com/mkumm) + - [Mike Roach](https://github.com/mroach) + - [Moshe Goldberg](https://github.com/mogold) + - [MzRyuKa](https://github.com/rykawamu) + - [n8n - Workflow Automation](https://github.com/n8nio) + - [Nashwan Azhari](https://github.com/aznashwan) + - [Natanael Sirqueira](https://github.com/natanaelsirqueira) + - [Nathaniel Knight](https://github.com/nathanielknight) + - [Nayuki](https://github.com/Kuuuuuuuu) + - [NFIBrokerage](https://github.com/NFIBrokerage) + - [Nick Chapman](https://github.com/nchapman) + - [Nick Reynolds](https://github.com/ndreynolds) + - [Nicklas Sindlev Andersen](https://github.com/NicklasXYZ) + - [Nikita Arkhipov](https://github.com/kritik94) + - [Nikita Sobolev](https://github.com/sobolevn) + - [NineFX](http://www.ninefx.com) + - [Nomio](https://github.com/nomio) + - [Ocean Armstrong Lewis](https://github.com/oceanlewis) + - [OldhamMade](https://github.com/OldhamMade) + - [Ole Michaelis](https://github.com/OleMchls) + - [optizio](https://github.com/optizio) + - [Patrick Wheeler](https://github.com/Davorak) + - [Paul Gideon Dann](https://github.com/giddie) + - [Paul Guse](https://github.com/pguse) + - [Pawel Biernacki](https://github.com/biernacki) + - [Pedro Pires](https://github.com/onelikeandidie) + - [Pete Jodo](https://github.com/petejodo) + - [Peter](https://github.com/peterpanduro) + - [Peter Rice](https://github.com/pvsr) + - [Peter Saxton](https://github.com/CrowdHailer) + - [PgBiel](https://github.com/PgBiel) + - [Philip Giuliani](https://github.com/philipgiuliani) + - [Piotr Szlachciak](https://github.com/sz-piotr) + - [Prashant Singh Pawar](https://github.com/prashantpawar) + - [qingliangcn](https://github.com/qingliangcn) + - [Race Williams](https://github.com/raquentin) + - [racerole](https://github.com/racerole) + - [Rahim](https://github.com/adoublef) + - [Rahul Butani](https://github.com/rrbutani) + - [Rasmus](https://github.com/stoft) + - [Raúl Chouza ](https://github.com/chouzar) + - [Redmar Kerkhoff](https://github.com/redmar) + - [Ricardo](https://github.com/soyricardodev) + - [Ricardo Fernández Serrata](https://github.com/Rudxain) + - [Richard Viney](https://github.com/richard-viney) + - [Rico Leuthold](https://github.com/rico) + - [Robert Attard](https://github.com/TanklesXL) + - [Robert Ellen](https://github.com/rellen) + - [Robert Malko](https://github.com/malkomalko) + - [Roberto Trevisan](https://github.com/tubedude) + - [Robson Gian Perassoli](https://github.com/robsonperassoli) + - [Ross Bratton](https://github.com/brattonross) + - [Ross Cousens](https://github.com/rcousens) + - [Sam Aaron](https://github.com/samaaron) + - [Sami Fouad](https://github.com/samifouad) + - [Sammy Isseyegh](https://github.com/bkspace) + - [Samu](https://github.com/scristobal) + - [Samuel Burkhardt](https://github.com/Aryezz) + - [Santi Lertsumran](https://github.com/mrgleam) + - [sarna](https://github.com/sarna) + - [Satoshi Yoshikawa](https://github.com/emergent) + - [Saša Jurić](https://github.com/sasa1977) + - [Scott Patten](https://github.com/spatten) + - [Scott Trinh](https://github.com/scotttrinh) + - [Scott Wey](https://github.com/scottwey) + - [Sean Jensen-Grey](https://github.com/seanjensengrey) + - [Sebastian](https://github.com/sporto) + - [sekun](https://github.com/sekunho) + - [Sergei Suvorov](https://github.com/crackhead-koala) + - [Seve Salazar](https://github.com/tehprofessor) + - [Shane Handley](https://github.com/shanehandley) + - [Shaun McCarthy](https://github.com/isocuda) + - [Shuqian Hon](https://github.com/honsq90) + - [Sidney Millen](https://github.com/SidneyMillen) + - [Simon Curtis](https://github.com/simon-curtis) + - [Simone Vittori](https://github.com/simonewebdesign) + - [Siraj](https://github.com/syhner) + - [Skenvy](https://github.com/Skenvy) + - [star-szr](https://github.com/star-szr) + - [Szymon Wygnański](https://github.com/finalclass) + - [Sławomir Ehlert](https://github.com/slafs) + - [Theo Harris](https://github.com/Theosaurus-Rex) + - [Thomas](https://github.com/thomaswhyyou) + - [Tim Heaney](https://github.com/oylenshpeegul) + - [Tim Morgner](https://github.com/Baspla) + - [Timm Friebe](https://github.com/thekid) + - [Timo Sulg](https://github.com/timgluz) + - [Tomasz Kowal](https://github.com/tomekowal) + - [trag1c](https://github.com/trag1c) + - [Tristan Cacqueray](https://github.com/TristanCacqueray) + - [Tristan Sloughter](https://github.com/tsloughter) + - [veryyet](https://github.com/veryyet) + - [Vic Valenzuela](https://github.com/sandsower) + - [Victor Rodrigues](https://github.com/rodrigues) + - [victorybhg](https://github.com/victorybhg) + - [Viv Verner](https://github.com/PerpetualPossum) + - [Vladimir Kidyaev](https://github.com/krios2146) + - [Vladislav Botvin](https://github.com/darky) + - [Volker Rabe](https://github.com/yelps) + - [Weizheng Liu](https://github.com/weizhliu) + - [Wesley Moore](https://github.com/wezm) + - [wgancar](https://github.com/wgancar) + - [Willyboar](https://github.com/Willyboar) + - [Xavier Drdak](https://github.com/xdrdak) + - [Xavier Noria](https://github.com/fxn) + - [xhh](https://github.com/xhh) + - [Yamen Sader](https://github.com/yamen) + - [Yaroslav Lapin](https://github.com/JLarky) + - [Yasuo Higano](https://github.com/Yasuo-Higano) + - [Yu Matsuzawa](https://github.com/ymtszw) + - [zahash](https://github.com/zahash) + - [Zsombor Gasparin](https://github.com/gasparinzsombor) + - [Šárka Slavětínská](https://github.com/sarkasl) + +Thanks for reading, and I hope you enjoy Gleam v1 💜 + +
+ Try Gleam +
+ + diff --git a/images/news/gleam-v1.1-released/imports.png b/images/news/gleam-v1.1-released/imports.png new file mode 100644 index 00000000..21223a6b Binary files /dev/null and b/images/news/gleam-v1.1-released/imports.png differ diff --git a/images/news/gleam-v1.1-released/spread.png b/images/news/gleam-v1.1-released/spread.png new file mode 100644 index 00000000..5d8f9572 Binary files /dev/null and b/images/news/gleam-v1.1-released/spread.png differ diff --git a/images/news/gleam-v1.1-released/tuple.png b/images/news/gleam-v1.1-released/tuple.png new file mode 100644 index 00000000..dfc3867f Binary files /dev/null and b/images/news/gleam-v1.1-released/tuple.png differ diff --git a/images/news/gleam-v1.1-released/unused.png b/images/news/gleam-v1.1-released/unused.png new file mode 100644 index 00000000..dd09208c Binary files /dev/null and b/images/news/gleam-v1.1-released/unused.png differ diff --git a/styles/main.css b/styles/main.css index 33c16a32..068ae6f7 100644 --- a/styles/main.css +++ b/styles/main.css @@ -131,7 +131,6 @@ p { a:visited, a { - word-break: break-all; color: var(--color-white); text-decoration-color: var(--color-faff-pink); } @@ -217,7 +216,7 @@ main.content { content: url("/images/lucy/lucyhappy.svg"); transform: rotate(13deg); } -.hero-lucy:hover{ +.hero-lucy:hover { content: url("/images/lucy/lucyhappy.svg"); transform: rotate(13deg); } @@ -681,6 +680,7 @@ main.content { .page.content { padding-bottom: var(--gap-4); + overflow-wrap: break-word; } .page pre { @@ -709,7 +709,7 @@ main.content { margin-bottom: var(--gap-4); } .news-posts li::before { - content: ''; + content: ""; position: absolute; display: block; width: 4px; diff --git a/writing-gleam/gleam-toml.md b/writing-gleam/gleam-toml.md index 153c49c1..f9419a4f 100644 --- a/writing-gleam/gleam-toml.md +++ b/writing-gleam/gleam-toml.md @@ -108,7 +108,7 @@ extra_applications = ["inets", "ssl"] typescript_declarations = true # Which JavaScript runtime to use with `gleam run`, `gleam test` etc. -runtime = "node" # or "deno" +runtime = "node" # or "deno" or "bun" # Configuration specific to the Deno runtime (optional) # https://deno.land/manual@v1.30.0/basics/permissions#permissions