Hacker News new | past | comments | ask | show | jobs | submit login

Not sure if it's because of rust (not super familiar with the language) but the syntax seems really awful





Yeah, I'm not the biggest fan of the syntax still either. That said, the phrasing of your comment is unkind and its contents don't provide any useful feedback.

...unkind...

Please don't misinterpret in this way. This is a candid reaction. As you indicate, it confirms your previous observations. This is not an opinion of you or any other Rust developer. It is an opinion of the syntax, period.


It's unkind to call someone else's work "awful," even if its meant in a very minor way (even if I agree with it!). It's a low value comment when it doesn't provide any concrete feedback on top of that. Our industry has abysmal standards for discourse and I'm not sure why you think that's important to apologize for and normalize.

Some pushback: The syntax used in your example is WAY cleaner to my eyes than competing UI solutions in Rust today.

<3

As a Rust lover, it can be quite the hill to climb when you first start looking at it. Closures really weirded me out when I first started.

Though, you may also be referring to the "made up language" powered by the Macros. I agree that can be a bit much, but it's in my view no more distracting than React's JSX. Some people hate JSX, and I imagine they would hate this as well.


I'm not a Rust user either. It's a lot of "symbol noise" to me, but I assume this is the kind of thing you get used to reading after a while. However it looks very annoying to type all those symbols, even if you have some kind of customized ergo keyboard.

> some kind of customized ergo keyboard

I use an ErgoDox, and while my layout isn't customized for writing mox invocations, it hadn't occurred to me that this might be a blind spot in my thinking about ergonomics. Good point!


I didn't really see anything that was weird whatsoever from a normal day to day programmer (Rust or not) perspective so I wouldn't take his feedback to heart or worry about your ergodox.

It seemed like a high ratio of "non-alphanumeric symbols" compared to a lot of other code that I read and write.

I suspect you are keying on some of the Rust language bits in the middle of his syntax.

_ is "don't complain because I don't use this variable"

|| is the syntax around Rust closures

foo! is a Rust macro

Why this is desirable is that we can program in real Rust while using some simple macro expansion not to create a free standing language for gui building?

Learning Rust via this gui library might not be the best choice(?) and I think it's better he focus on people that know Rust already.


The code in the OP appears to largely be a custom-built DSL designed to emulate XML. One can tell it's a custom DSL by dint of looking at the `mox!()` invocation; any identifier followed by a bang in Rust is a macro (Scheme-style syntax-aware macros, not C-style textual macros), which have loose parsing rules to allow for such DSLs to be defined.

Rust does have plenty of symbols (nearly all of which are lifted directly from C or C++, with the same or analogous meanings), but such extensive DSLs are rarely encountered in the course of everyday use of the language.


Syntax only matters to people who don't know the syntax. I used to think it was awful before learning Rust, but very quickly the syntax just fades into the background because syntax is patterned and repetitive by definition. There's an initial barrier to entry then an abrupt payoff cliff.

The important thing is actual expressiveness. Rust gives you a heavy duty toolbox to play with. You could have a beautiful-looking syntax with no braces, no parens, and tons of whitespace (think CoffeeScript or Haskell) where you're very restricted on a small set of square pegs, or you could use something like C++, (Perl), Rust, or Lisp that lets you make any Rube Goldberg machinery you want no matter how hideous it looks. It's a matter of personal preference. You can be very effective either way, but I think one is unnecessarily harder on yourself.

There are two camps:

1. Syntax is important. I want everything to line up beautifully on the screen. I have a riced out Arch desktop and a super clean enviable desk with modern furniture.

2. Syntax doesn't matter. I format code sloppily and let clang-format fix it eventually. I love macros and codegen because they make my life easier. I haven't changed my wallpaper in 5 years.


I know you're being somewhat facetious but... not really. To me, syntax is important, and I want everything to line up beautifully on the screen. But I use a simple, no-frills Debian Xfce desktop, and my "desk" is my lap and my couch.

It is awful. Javascript with JSX is awful, too.



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

Search: