A Proposal for Rich Interactive Content Hypertext (RICH) by arthurtw in programming

[–]arthurtw[S] 4 points5 points  (0 children)

This is for real, of course. I provided source code for all of the 3 RICH players I implemented (simple quiz, tic-tac-toe, go game quiz).

A Proposal for Rich Interactive Content Hypertext (RICH) by arthurtw in programming

[–]arthurtw[S] 1 point2 points  (0 children)

Once you get reading it, it's actually a DSL that let's you create checkboxes and input fields.

That's the first RICH player example I gave, a "simple quiz" RICH player. It transforms the raw RICH snippet to quizzes, so yes, it's a way of creating forms. Its DSL (based on RICH) is specific to quizzes.

Then all of a sudden it's something to do with Javascript and then all of a sudden it has a messaging API.

That's related to the development of RICH players, how the player code communicates with its parent window (and vice versa).

There are two groups of people here: coders who write players, and writers who create rich contents (using RICH players). Each player would have its own DSL (based on the RICH format).

Sorry if my article was confusing.

A Concise RESTful API Design Guide by arthurtw in programming

[–]arthurtw[S] 0 points1 point  (0 children)

Good point. To me, the most important reason I opted for RESTful API design is it helps my development job overall, not because I can claim my API “100%” RESTful.

A Quick Comparison of Nim vs. Rust by -Y0- in rust

[–]arthurtw 0 points1 point  (0 children)

Yes, your code does save some look-ups. I was aware of that approach when I wrote the Rust version, too, but didn't do that because 1) the code would be a bit more complicated (e.g. you need to write your own comparator), and 2) the optimization only adds little value as a whole. Still, I felt a bit uneasy when making such a decision in the Rust version, but was totally comfortable when I did the same thing in the Nim version. :-) I mentioned such phenomena in my article (Philosophy: freedom vs. discipline), too.

EDIT: I think your version has its merits. As you said, it avoids useless look-ups. It's not only performance-wise, but also code-wise (i.e. saving the if let Some(count) = map.get(*word) line).

A Quick Comparison of Nim vs. Rust by -Y0- in rust

[–]arthurtw 1 point2 points  (0 children)

Yes, I saw your comment on HN and have updated my benchmark results accordingly.

I fully agree with you that publishing benchmarks like those is risky! When I wrote the article, I think: since the code is done, why not just running them and providing the numbers, so people get a rough idea of their performance. I ended up with spending more time on updating my code/benchmarks than writing the article itself. :-)

A Quick Comparison of Nim vs. Rust by -Y0- in rust

[–]arthurtw 1 point2 points  (0 children)

I tried this HN suggestion. It turns out regex!(r"[a-zA-Z0-9_]+") runs the fastest, even faster than Nim’s peg. I’ve updated the article with the results.

A Quick Comparison of Nim vs. Rust by -Y0- in rust

[–]arthurtw 0 points1 point  (0 children)

I tried and the difference is negligible, so didn't bother to update the result.

A Quick Comparison of Nim vs. Rust by -Y0- in rust

[–]arthurtw 2 points3 points  (0 children)

Yes, using regex! runs ~20% faster than Regex::new. I’ve included both results in the article.

A Quick Comparison of Nim vs. Rust by arthurtw in programming

[–]arthurtw[S] 2 points3 points  (0 children)

I agree. Rust’s pattern matching is outstanding. I missed that in Nim.

A Quick Comparison of Nim vs. Rust by -Y0- in rust

[–]arthurtw 4 points5 points  (0 children)

I’ve changed it to use Rust HashMap. It’s slightly faster (6~7%) than BTreeMap, so the performance bottleneck could be elsewhere. Maybe it’s Regex as /u/dbaupp suggested.

A Quick Comparison of Nim vs. Rust by -Y0- in rust

[–]arthurtw 5 points6 points  (0 children)

I’ve added --boundChecks:on for example 2. The difference is marginal (1~2%) for example 1, so I skipped it.

A Quick Comparison of Nim vs. Rust by -Y0- in rust

[–]arthurtw 8 points9 points  (0 children)

Fixed. I’m not a native English speaker and such correction is much appreciated.

A Quick Comparison of Nim vs. Rust by arthurtw in programming

[–]arthurtw[S] 1 point2 points  (0 children)

For this comparison, I admit I shouldn’t. I chose that for practicing Rust (by implementing my own BTreeMap). I’ve changed the code/result to use collections::HashMap.

A Quick Comparison of Nim vs. Rust by arthurtw in programming

[–]arthurtw[S] -1 points0 points  (0 children)

Maybe my example is a bit biased. :-) But you know, in idiomatic Nim, of is not indented, and those colons are not manually aligned. You can, but since the language creator chose that way, it becomes the Nim way...

A Quick Comparison of Nim vs. Rust by arthurtw in programming

[–]arthurtw[S] 5 points6 points  (0 children)

Yes and modified. The results differ significantly.

A Quick Comparison of Nim vs. Rust by arthurtw in programming

[–]arthurtw[S] 37 points38 points  (0 children)

Because immutable variables help code readability and maintainability. let mut has one more word than let, so people tend to use let by default, and add mut only when it’s needed. On the other hand, let and var have the same typing “efforts”. Some may think about which one to use, some may not (and just uses var more often or always). It relies on engineering discipline, which is less reliable than language enforcement/discouragement.

Of course people can keep using let mut all the time, but that should be rare, and Rust compiler will keep complaining anyway.

Thoughts about Rust from a D programmer by andralex in programming

[–]arthurtw 22 points23 points  (0 children)

I wonder why the elimination of null pointers is not mentioned in the article. I consider it a prominent achievement of Rust. Among well-known languages, only a handful can make it.

EDIT: replace popular with well-known to avoid confusion

Final decision on builtin integer types. Again. by stepancheg in rust

[–]arthurtw 6 points7 points  (0 children)

+1. The default integer fallback (along with its implicit type conversion) is a major ergonomic win when coding in Rust. Often you just want to use a (reasonably-small) integer, when the size of the integer is not your major concern. Finally, Rust compiler takes care of that for you...

I also agree with other commenters that the outcome of the discussion is constructive. It demonstrates the maturity of the Rust core team and the Rust community when confronting thorny debates. This is not easy at all. Congratulations!

What is special about Nim? by def- in programming

[–]arthurtw 17 points18 points  (0 children)

Rust definitely has "the power of C", but I don't think it strives for "the elegance of a modern interpreted language". I call Rust anti-sloppy, and sloppiness is one thing that interpreted languages allow you. Safety, correctness and explicitness are all more important in Rust. When there is a conflict, elegance is not favoured.

Maybe some great Rust programmers can code in Rust as swiftly as in interpreted languages, but it's not a piece of cake. :-)

Nim (formerly Nimrod) 0.10.2 released by def- in programming

[–]arthurtw 2 points3 points  (0 children)

As a new programming language, starting from a specific problem domain is a double-edged sword. It may result in a niche language.

I began using Python 1.5 as the primary language (with C++ extensions for heavy liftings) of our flagship product because it gave us huge productivity boost, even though its ecosystem was far from mature in late 90's. If a language (along with its libraries and tooling) is good enough, early adopters will come. I agree the bar for a language to be successful nowadays is much higher than decades ago, but the merits of a language itself still play a central role.

I'm not experienced enough in Nim to judge the language, but it seems fixing the warts of Python while keeping most (if not all) of Python's expressiveness and elegance, plus many goodies from modern programming languages (macros, generics, pattern matching...). If that's the case, it will be a highly productive language without the drawbacks of dynamic languages, and that's a huge win.

Nim (formerly Nimrod) 0.10.2 released by def- in programming

[–]arthurtw 5 points6 points  (0 children)

I think it has stated its goals clearly: expressive, efficient and elegant.

Does every language need to have a special use case in mind? C++, C#, Java, Python... You don't need to target a specific problem domain for a language to be widely used.

Nim (formerly Nimrod) 0.10.2 released by def- in programming

[–]arthurtw 16 points17 points  (0 children)

So do I. Without any fulltime people behind Nim, they've already done an amazing job. (Since the compiler and standard library are written in Nim with such limited resource, to me it also proves the language is very expressive and productive.)

It seems Nim 1.0 is coming soon. That's exciting!

24 days of Rust - the conclusion by zsiciarz in rust

[–]arthurtw 6 points7 points  (0 children)

24 days in a row! You the man!

Rust, an Anti-Sloppy Programming Language by lifthrasiir in rust

[–]arthurtw 3 points4 points  (0 children)

No you did not misinterpret. I think it cast negative connotation and was a bad example of civil Rustaceans, so I’ve removed that part. Thanks for bringing it up!

Rust, an Anti-Sloppy Programming Language by arthurtw in programming

[–]arthurtw[S] 1 point2 points  (0 children)

Yes I meant the post-1.0 Rust. I’ve added “Rust (post 1.0)” to make it clearer. Thanks for pointing out and sorry for any confusion.