25 ms·
I've been writing an mbox parser with gleam and use is really hard to grok for me. I get the use, but in contrast to nearly everything else in the language, it
by e3bc54b2 2y ago
I've been writing an mbox parser with gleam and use is really hard to grok for me. I get the use, but in contrast to nearly everything else in the language, it just isn't clearly composable with other stuff. The moment use is introduced, everything below becomes part of it. It is hard for me to express this, but use feels overloaded with its use-cases in real world.
- behnamoh 2y ago> The moment use is introduced, everything below becomes part of it. It is hard for me to express this, but use feels overloaded with its use-cases in real world. Exactly! It's one of the rare ugly parts of Gleam, and I sincerely hope "use" doesn't catch on (it seems like many people find it inconsistent and won't use it anyway).
- faitswulff 2y agoYou can put the use statement inside brackets (i.e. `{ use xyz ... }`) to limit the scope of the use statement. I fully agree it's unexpected that everything after the use statement becomes part of the body of the use statement.