Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 1. Can multiline strings be indented, with the indentation stripped out?

Not at present, though this would be a nice feature to have. Perhaps open an issue on the issue tracker if you have ideas for syntax or behaviour.

> 2. Why do floats have their own operators?

Gleam's functions and operators are monomorphic- they take precisely 1 datatype. There is no overloading, interfaces or type classes which would be used to have operators work on Ints and Floats but no other type.

We may support this kind of polymorphism later, though we want to ensure the design is right rather than rushing to any particular solution.

> 3. What's the rationale for lists and tuples being different, and not just allowing lists to include different types?

Type safe lists of arbitrary lengths that contain multiple types are difficult to work with, typically a single type is much easier to work with and covers the vast majority of use cases. If you wish to store multiple types in a list you would wrap them in a custom type (a tagged union) which would give the programmer an easy way to defferentiate between the different values in the list.

> 4. How are module paths resolved?

There is a global module namespace. The `src` and `test` directories are considered the root of the namespace, and the file path relative to there dictates the module path. Some more info can be found here: https://gleam.run/tour/modules.html

> 5. Pattern matching looks great!

Thank you! It's one of Erlang's best features.

> 6. Function argument labeling looks great, I wish all languages did this!

We got the idea from Swift! All the credit to them.

> 7. Type system looks simple but capable, but in the User example it looks like the LoggedIn constructor isn't namespaced to User, so what happens if another type has the same constructor name? Conflict?

Yes, you cannot define two constructors (or functions, or types) with the name module with the same name.

> On the same note, can you extend custom types after declaration, by adding constructors? (A little like Clojure protocols) > 8. Can functions be overloaded, so you can provide multiple implementations for different argument signatures? > 9. Can you implement custom operators, so you can for example `+` custom types together?

No, these features are not currently supported. We may add something in this direction at a later date if we have a good proposal that fits well with the languaage and provides clear benefits.

> I too miss the concurrency aspects given it's built on Erlang.

They are still there! They're just libraries rather than having dedicated syntax.

https://github.com/gleam-experiments/otp_agent https://github.com/gleam-experiments/otp_process

> Great work, definitely going to follow this!

Thank you



Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: