Essential insights from Hacker News discussions

Show HN: AGL a toy language that compiles to Go

The Hacker News discussion largely revolves around a new language or library called AGL, which aims to improve upon existing languages like Go by introducing features such as Option/Result types and compile-time functionalities. The conversation highlights the inspiration behind AGL, its potential benefits and drawbacks, and specific design choices.

Introduction of AGL and Feature Set

The discussion begins with users expressing interest in AGL, particularly its adoption of Option/Result types, a feature commonly found in languages like Swift and Vlang. This signifies a desire for more robust error handling and safer programming practices.

"That's pretty cool, I ways want Result/Option/Err types in python." - mayli

"Have you seen https://vlang.io/?" - 18172828286177

"https://docs.vlang.io/type-declarations.html#optionresult-ty... in particular" - 18172828286177

Inspiration and Development Speed

The creator of AGL, alain_gilbert, states that the project was inspired by Swift and Vlang. A significant aspect noted by users is the incredibly short development time of "only two weeks," which is met with surprise and admiration, suggesting a rapid prototyping or a highly efficient development process.

"Yes, I got my inspiration mainly from swift and a little bit from vlang as well." - alain_gilbert

"Cool language. Only two weeks for this? Damn!" - ben0x539

Comparison to Go and Quality of Life Improvements

Several commenters, including ben0x539, see AGL as a significant improvement over Go, addressing pain points experienced by developers who also use more expression-based languages. The ability to integrate with existing Go code is highlighted as a major advantage.

"This seems to nicely smooth out a lot of the pain points I had back when I regularly wrote Go but also switched to other more expression-based languages occasionally. Being able to get all these conveniences while still being able to call into existing Go code seems amazing!" - ben0x539

Specific AGL Features and Design Choices

Optional Value Propagation vs. Short-Circuiting: LudwigNagasena raises a crucial design question regarding AGL's approach to optional value propagation, comparing it to short-circuiting mechanisms in C#, JavaScript, and Swift. This prompts a discussion about different error handling strategies and their implications.

"Propagation of optional values is an unconventional design decision. Why have you chose it over short circuiting as in C#, JS, Swift?" - LudwigNagasena

Error Wrappers and Stack Traces in Go: The same commenter, LudwigNagasena, also inquires about AGL's stance on the complexity introduced by error wrappers and stack trace providers common in Go projects. They question whether AGL has consciously avoided these or if it's an area yet to be fully addressed.

"What’s your opinion on error wrappers and stack trace providers that are often used in go projects complicating simple error propagation? Have you consciously avoided adding similar functionality or just haven’t thought about it yet?" - LudwigNagasena

Compile-Time Functionality: The discussion touches upon compile-time features, specifically the "@LINE" pseudo-variable. The potential of such features to enhance development and debugging is implicitly acknowledged.

"the @LINE "Compile time pseudo variable"" - eg

AI-Generated Logo: A lighthearted observation is made about the use of AI for the AGL logo, which the creator, alain_gilbert, confirms.

"Also, I appreciate the pun, but did you have to use AI for the logo? Haha" - ben0x539

"I did use AI for the logo!" - alain_gilbert

Go Library Integration Challenges: alain_gilbert identifies a significant challenge in integrating with non-standard Go libraries, requiring manual type redefinitions. While working on automatic generation of these wrappers, specific complexities like wrapping pointers in Option[T] for recursive data structures (e.g., linked lists) are highlighted as difficult problems.

"Using Go libraries is still kinda rough, the standard library works fine, but for other libraries you'd need to (re) define the types manually. I'm trying to make something that would generate it all automatically, but there is some problems that I don't know how I would solve." - alain_gilbert

"For example, I'd like to have the pointers being automatically wrapped in a Option[T], but then if you have something like a linked list, with a struct containing pointers to other nodes, it gets complicated." - alain_gilbert

Nil Pointers and Enums: lordofgibbons raises a concern about the continued possibility of nil pointers in AGL, viewing the absence of native enums as a significant pet peeve. alain_gilbert confirms that nil is currently part of the language to facilitate interoperability with other libraries but expresses a desire to remove the nil keyword if automatic wrapper generation becomes feasible.

"Are nil pointers still possible/allowed in AGL? After a lack of enums, this is my biggest pet peeve." - lordofgibbons

"But unlike borgo, yes, at this time nil is part of the language, which allows you to use other libraries without the need to make laborious wrappers. But if I can manage to create a script to automatically make the wrappers, I'd love to remove the nil keyword entirely." - alain_gilbert

Iterative Development and Openness to Feedback

alain_gilbert demonstrates an iterative and experimental approach to AGL's development, acknowledging that many aspects are subject to change. the creator expresses gratitude for feedback, particularly on aspects that might not make sense, emphasizing the project's early stage and the willingness to adapt.

"I haven't think much about it, a lot of things are probably going to change. I tried to get something working as fast as I possibly could, and in two weeks, lots of corners were cut to make it happen." - alain_gilbert

"The user may say something that makes no sense, but maybe they are right and there is some good idea to steal." - alain_gilbert

"Thanks for the feedback, it's good to know when something does not make sense ^^" - alain_gilbert