6 ms·
One thing that takes away from programming languages is not having code samples on the index. I think this lets someone know immediately if it's interesting to
by giancarlostoro 7y ago
One thing that takes away from programming languages is not having code samples on the index. I think this lets someone know immediately if it's interesting to them or not. Show a sample of code with the console output or a screenshot of an UI from the code. I think Racket had it right ages back. They would show everything from a web server, to other things. This is what major programming languages (with some exceptions) basically do and it gives a developer more information than any amount of marketing speak.
That said, I had to dig in the documentation to find code, and it didn't seem as obvious cause the syntax is definitely different from what I'm used to and there's weak syntax highlighting.
- blain_the_train 7y agoSmall code samples tell me next to nothing. How could they. I want a clear explanation of the foundational aspects.
- dunefox 7y agoI want both.
- giancarlostoro 7y agoThat's the ideal amount of information. A reasonable example of a good page that is informative and provides lots of examples (enough at least!) is the one for D: https://dlang.org/ https://dlang.org/
- dunefox 7y agoI also like the "Ecosystem" part of Julia: https://julialang.org/ https://julialang.org/ Sadly, for some reason code samples are lacking.
- giancarlostoro 7y agoJulia is a language I love that I don't see myself using sadly. It does some amazing things that leave me shocked, like it can show you the assembly you generate while using a REPL. That's impressive to me. However, I'm not the target developer for Julia. Edit: Course after clicking your link, I am wondering how wrong I am since it is still technically general purpose capable. Wow Julia has grown so much!
- eigenspace 7y agoOut of curiosity, what sort of development do you do? Julia is a very flexible language. The majority of its community is still focused on numerical scientific computing, but it's great for all sorts of usecases these days. The way I think of it, in order to build a language that was flexible enough to cover all these different weird needs you find in the scientific computing community, they ended up needing to build a general purpose language.
- Minor49er 7y agoHow can you choose a language without knowing the syntax? It's not arbitrary. Some languages have elegance or gotchas in how the syntax is laid out
- dudul 7y agoHow can you tell the elegance or gotchas from a 6 line Hello World?
- giancarlostoro 7y agoIt's how I picked my favorite Python web framework, I compared all the hello world samples they all had, and wound up with CherryPy. The rest had too many decorators and it just looked silly to me. You can also figure out if it's C-like or Lisp-like, and so on from looking at syntax.
- rixed 7y agoFrom what you describe, sounds to me you picked your framework mostly at random, like one would pick a car for its color.
- neurobashing 7y agoyou can infer a lot; is it LISPy, is it C-ish, or one of the Haskell family, etc. I think you can tell a lot from just which family of syntax.
- cttet 7y agoNo, take Reason as an example: it is basically Ocaml. Despite having a C-like syntax, it is quite different from it. The syntax barrier is usually much smaller than the language itself.
- CarlRJ 7y agoAnd yet... someone trying to “sell” me a language while seemingly refusing to show me any code samples feels like someone trying to sell me a car based entirely on a spec sheet with no pictures and without actually seeing, touching or experiencing the car. They both provoke a reaction of suspicion - “what are they trying to hide?” As if they don’t trust me, the customer, to be able to understand the very thing they want/expect me to buy. I’m perfectly fine with a page that says, “here’s a code sample - notice that it looks similar to C, but here’s a list of reasons / an explanation of why/how it’s actually quite different from C.” One of my favorite programming books of all time is K&R, from back before ANSI, even. It said, “here’s a simple problem to solve, and here’s how you solve it in our language.” Repeatedly. Explaining how the features helped to solve the problem at hand. It was revelatory. And it assumed its audience to be knowledgeable programmers. It didn’t spend the first chapter just describing all the features or how great the language is without showing any code.
- robofanatic 7y agoLittle code snippets are nice to get a quick feel of the language. A good "Get Started" page is also a must have. I love languages or frameworks that have a step by step clear instructions on how to get started. It's almost like taking test drives when you go car shopping. You don't want to open the hood and check what's inside right away you just want to be able to drive the car.
- scott_s 7y agoI don't want small code samples. I want well defined problems that this particular language is well suited for, as demonstrated by a dozen (or a few dozen) line program which uses the core features of the language to elegantly solve that problem. That gives me a feel for what the language is, and if interested, I'll learn about the foundations.
- Tade0 7y agoPerhaps this is the reason: https://www.unisonweb.org/docs/language-reference#a-note-on-syntax https://www.unisonweb.org/docs/language-reference#a-note-on-...
- giancarlostoro 7y agoThanks for this, I totally missed this nugget. If it's on the front-page it should be made more obvious. Whether it's code or some sort of video, every language should showcase something that tells you what development is like. Code you can interactively compile from a front page is always a plus too.
- ktpsns 7y agoInteresting. Maybe they should add further representations of the code. This is not the only language where there are mutliple representations of the same "code". Wolfram Mathematica (or "the Wolfram language") introduced "forms" for that, for instance https://reference.wolfram.com/language/ref/FullForm.html https://reference.wolfram.com/language/ref/FullForm.html or https://reference.wolfram.com/language/ref/InputForm.html https://reference.wolfram.com/language/ref/InputForm.html or, quite charming in the math context, https://reference.wolfram.com/language/ref/TraditionalForm.html https://reference.wolfram.com/language/ref/TraditionalForm.h... or https://reference.wolfram.com/language/ref/TeXForm.html https://reference.wolfram.com/language/ref/TeXForm.html -- See also https://reference.wolfram.com/language/tutorial/EverythingIsAnExpression.html https://reference.wolfram.com/language/tutorial/EverythingIs...
- dunham 7y agoAlso Bucklescript and ReasonML respectively provide OCaml and javascript-like syntax over the same AST and can translate your code between the two (as seen in the try reasonML UI).
- floatboth 7y agoThat's not exactly how it works: Bucklescript is a JS backend for OCaml, and ReasonML is an alternative syntax for OCaml. Bucklescript is not involved in this translation, it generates the JS output on the top right pane of that UI.
- xixixao 7y agoTBH if you're creating a new language after 2014 you should be thinking about how to get good syntax highlighting and other tooling from the language definition itself, because you're competing with a ton of mature languages that had to do this manually through a ton of effort of their communities.
- DelightOne 7y agoHow do you get it from the language definition? By adding metadata to it?
- unlinked_dll 7y agoIt can be (kinda) done if your language has a parsing grammar. It doesn't work in practice, since most languages eventually discard parser generators for custom parsing, and good tooling like syntax highlighters don't rely on the literal grammar but something close enough to the grammar to work and still be useful for programmers. Classic example is you don't want your parser to be strictly defined and fail at any error. You want it to handle errors gracefully and detect almost correct syntax. Having written some textmate grammars for syntax highlighting I think the post is ridiculous. I'd be terrified to generate that json from the parser, since a bit of thought and experimentation has to go into getting a good syntax highlighter that works with external tooling. As well I think an LSP implementation is really important, but writing that in your language or generating it from the compiler is a monumental task for a young language and a terrible idea.
- ahel 7y agohave a look if you want some example and what dev process looks like https://dev.to/petets/palindromes-with-unison-5h9o https://dev.to/petets/palindromes-with-unison-5h9o
- perfunctory 7y ago> One thing that takes away from programming languages is not having code samples on the index. I think this lets someone know immediately if it's interesting to them or not. Because when I see Chinese characters I know immediately if it's interesting to learn Mandarin or not.