1. 2

    This is awesome! Is it using any exciting PL theory?

    1. 29

      After dropping out twice, and just barely meeting the requirements… I’m graduating college!!

      1. 3

        Congratulations!

        1. 1

          Thanks!

        2. 1

          Congratulations!

          1. 1

            Thanks!

        1. 6

          I use Caddy to serve static files. I couldn’t be happier with it: totally takes care of https which was a pain even with nginx and let’s encrypt.

          Digital ocean droplet + namecheap = best money I’ve ever spent.

          Edit: Oh yeah and rsync for actually moving the files. (Way faster than scp since it does diffing)

          1. 2

            Is anybody else a little annoyed by all these people referring to Python and Ruby as scripting languages ಠ_ಠ

            1. 11

              no, ‘scripting language’ has a well-understood meaning and perl, python and ruby certainly qualify

              1. 1

                “Scripting language” isn’t a very good distinction. People typically mean that the main implementation of it is an interpreter instead of a compiler, but defining a language by its implementation detail is a bit of questionable choice. Just because the implementation changes but the syntax and semantics doesn’t shouldn’t fundamentally change what a language is.

                “Scripting language” used to mean a programming language that was part of a larger system, a smaller thing for automating the execution of tasks, something that ran only within a specialised environment like an IRC program or a web browser, such as e.g. javascript or mIRCscript. That usage is almost dead now.

                And sometimes people are just ambiguous about which one of these two they mean.

                1. 2

                  After having considered this a bit, I’d defined “scripting language” as

                  • interpreted - i.e. no compilation stage before executing the source
                  • has good “hooks” into the computer’s file system and stuff like the Internet

                  So that would cover Perl, Python and Ruby, even if Perl explicitely grew out of the smaller, more specialized text processing tools like sed and awk, while Python approached the domain after having been designed as an educational tool.

                  1. 2

                    i’d define it as a grab-bag of features including:

                    • dynamically typed
                    • effectively interpreted (i.e. if it’s compiled under the hood that should be transparent to the user)
                    • good support for strings, lists and hashmaps, almost always including syntactic support and data literals
                    • having, as you note, good out-of-the-box support for filesystem operations and talking to the world
                    • the possibility to wrap and use C libraries
                    • eval
                    1. 1

                      Except for dynamic typing, all of this sounds like D, although you can sort of get something like dynamic typing in D via compile-time type inference.

                      Hell, if you use ghci, it also kind of sounds like Haskell. Or due to REPLs, it sounds like most or all lisps.

                      I still don’t think “scripting language” is a clear or useful distinction.

                    2. 1

                      I think I’d be able to qualify D as a scripting language, since it has curl in its stdlib (and obviously, filesystem), and you can use rdmd as a shebang, therefore getting rid of an obvious compilation step.

                      1. 1

                        That’s interesting to know!

                        1. 3

                          But note that rdmd is still a compiler. It just happens to be a “dumb” compiler that never frees memory during the compilation step, hence does no memory management and is therefore speedy enough to match most interpreters’ warmup time.

                          On the other side, most interpreters nowadays also do at least a little compilation. Python’s pyc files are one of the more obvious examples.

                          I’ve also heard people who have only used Python refer to C++ code as “C++ scripts”. The “scripting language” distinction really is nebulous.

                2. 1

                  But you think it’s ok to refer to Perl as one? Why?

                  The term is from the XCode beta release notes.

                  1. 0

                    I omitted Perl because I’m not as familiar with its internals. Both Python and Ruby compile to bytecode, and Ruby recently added a JIT. So neither language is interpreted.

                    1. 4

                      Taken from wikidepia:

                      The term “scripting language” is also used loosely to refer to dynamic high-level general-purpose languages, such as Perl, PowerShell, Python, and Tcl.

                      The term “scripting language” is a characterization of a language itself: being dynamic, high-level, and well-suited to small programs.

                      The term “interpreted” is a characterization of a particular implementation: is their an interpreter involved in running it? So a language can be both a scripting language and interpreted.

                      That said, both Python and Ruby are in my mind interpreted. They compile to a high level bytecode, which is subsequently interpreted. There are also interpreters for C, C++, and other non-scripting languages. Does that make them interpreted? Kind of, yeah, but I’d argue you wouldn’t apply the term “interpreted” to a language itself unless its one of the most common ways of running it.

                      1. 1

                        Script language vs compiled language. The unit of distribution for all three is still raw source code, or script.

                        1. 0

                          go get downloads source code and compiles locally. But Go is a compiled language.

                        2. 1

                          Thanks for the clarification!

                          I’ve not really thought about whether a language compiles to bytecode as a characteristic of being a “scripting language”.

                          Also, does Perl 5 have a bytecode stage? It depends.

                    1. 2

                      I think Pony a bit more cumbersome to use than many other languages, at least for a simple “Hello, World!” example in SDL2, but it feels surprisingly solid. https://github.com/xyproto/sdl2-examples/blob/master/pony/main.pony

                      1. 4

                        I will say, this is pony program that uses SDL by directly linking against external c functions! Most SDL hello world examples you’ll see in other languages use a library wrapping the external calls. I think it speaks volumes that in fact the Pony source is both readable and short, especially considering that Pony is a managed language, with support for actors. (In comparison, the C FFI in both Go and Erlang tends to be much harder)

                        1. 1

                          It uses SDL2 directly only because no SDL2 library were available for Pony at the time (I’m not sure if there is one available now).

                        2. 3

                          I just did some exercises in Pony and Rust and I definitely found Pony the more elegant and easy language; but with much worse library support

                          1. 4

                            We definitely have a considerably smaller community than Rust at this point. In part, I think that is:

                            1- Rust has corporate backing and people paid to work on it 2- It’s post 1.0 and most people won’t consider using pre-1.0 stuff

                            More people contributing to the Pony ecosystem (including libraries) is something we could really use and would happily support as best we can. We’ve had a lot of excited people start to pitch in. Most haven’t contributed to open source projects before and I think for many, the shine rather quickly rubs off. I don’t blame them, maintaining open source software is… well, it’s an “interesting hobby”.

                            1. 1

                              Absolutely agree. Even contributing to a few projects, I can see that I wouldn’t want to be a maintainer without being paid or “it” being my big idea.

                              I don’t do much system level programming, so I don’t need either, really, so I’m very unlikely to step up.

                              A bridge to rust might help though?

                              1. 5

                                A bridge to rust might help though?

                                Pony can directly call into C (and therefore into Rust) and generate C headers, which Rust can consume to generate interfaces. The biggest problem for “just” using both from both sides is language semantics outside of the function call interface that the C ABI provides. Also, Rusts ABI is currently private.

                                I don’t do much system level programming, so I don’t need either, really, so I’m very unlikely to step up.

                                Both Rust and Pony provide safety guarantees and features way past “safe systems programming” and Rust is definitely used as a “wicked fast Python” in some circles. It’s an interesting space to work in, currently :).

                          2. 2

                            I really like the syntax, and the underlying ideas. I recently speed read through the tutorial, and the most daunting aspect of it (for me) was the reference capabilities part. I hope I can find a side project to play with it some more.

                            Plus the language is named pony, which makes it instantly great. ;)

                          1. 0

                            Through interactivity, a well-designed explorable immediately invites the reader to play with the initial arrangement of elements, and thereby to discover potential problems on their own.

                            I am deeply, fundamentally, almost radically disinterested in interactive explorable widgets ala the example given. Visual examples have visual limitations: when you rely on your visual instincts to solve e.g., 8-dimensional math, you’re Doing It Wrong. Working through the essences (i.e., the actual symbolic & textual aspects of math), gives the requisite information. Occasionally a quick graph is useful to assist in intuition building in the 2-dimensional case….

                            1. 9

                              Np if that’s how you tend to learn, but I do learn math visually (and I have a math degree) and I don’t think I’m “Doing it Wrong” when I use use lower dimensional projections of higher dimensional spaces to better understand what’s happening.

                              1. 5

                                I think you may have missed the point. It’s not about “visual instincts”, it’s about actively engaging the brain, rather than have it passively take in information.

                                This is pretty much the only way to really learn new skills, which is hardly a new insight, and is why you should take notes during lectures etc. I can read all about carpentry or playing the guitar, but none of that makes me a carpenter or guitarist.

                                Unfortunately, many classrooms and online tutorials are in the “here is information, absorb it!” style. There is certainly a need for reference manuals and the like, but if you want to teach people novel insights then this is usually not the best way.

                                1. 2

                                  The author never stated visual anywhere in that paragraph. I think you may have deeply misunderstood the author. For example it’s nearly trivial to imagine an interactive math exercise that is non-visual.

                                1. 3

                                  You can implement exceptions, and even while loops, using algebraic effects! The koka paper does a good job explaining these.

                                  1. 2

                                    Love the “Press F2 to edit the current entry in the editor of your choice”. Tools working together :)

                                    1. 12

                                      The light-grey on light-grey is too hard for me to read, I had to stop :/

                                      1. 3

                                        I removed the opacity for u element in my web inspector. Note that a value of 0.5 (instead of 0.25) is fairly reasonable.

                                        I also have problems with this text disappearing sometimes: https://i.imgur.com/RPOQYdX.png – I added that red line myself to indicate missing text. Also note the &em; It seems to happen when I select/hover/click text? It’s pretty intermittent. Using Firefox.

                                        Arguably, such frequent use of asides is not a great writing style by the way.

                                        FYI @zge

                                        edit: I think you’re missing a “not” before “because” in this sentence here?

                                        But people have not tried to go “beyond” Unix, because they are evil or ignorant, but because the

                                        1. 1

                                          I’m sort of conflicted about raising the value to 0.5 (currently it’s at 0.3333, and 0.6666 when hovered over) since the <u> tags are unarticulated side notes, comments or background voices – I kind of abuse it too much, I admit that.

                                          All I can say about the disappearing text is that it works on my machine, even though I also just use Firefox… Maybe I should try opening it in chromium or some different engine.

                                          Also thanks for the hypo notice. Most of it was written just before midnight, so I didn’t get around to properly go over it again. I will be reformulating some of the sections, particularly those with many <u> tags, when I have the time, so hopefully I will also be able to make it a bit easier to read too.

                                          1. 3

                                            since the tags are unarticulated side notes, comments or background voices – I kind of abuse it too much, I admit that.

                                            In my personal opinion, side notes should rarely be used. It breaks the flow of the text, and much of the time it’s a “hack” for writing down a proper paragraph that flows well. In other cases, it’s just an aside which isn’t too relevant to the topic at hand, in which case it should probably just be omitted; more words does not equal a better article. I have similar feelings about text in parenthesis by the way, which some people over-use (including myself ☺), especially when it’s used as a hack to clarify a badly written sentence, instead of clarifying the sentence.

                                            At any rate, in your case because the asides are so often interspersed in regular paragraphs with a different colour, I find it breaks the regular “flow” of the paragraph, and everything comes across as “disjointed”.

                                            Just my 2¢. Writing is of course very subjective, so reasonable people could disagree.

                                            All I can say about the disappearing text is that it works on my machine, even though I also just use Firefox… Maybe I should try opening it in chromium or some different engine.

                                            I mucked about some more, and can reproduce it fairly reliable by selecting text with double/triple click, but only if there is a line break between [ and ] (in which case all text before the line break disappears). I tried looking at the JS, but it’s all minified.

                                        2. 2

                                          if you’re reading on Firefox then you can activate reader mode which makes the reading experience quite pleasant. It looks like this. You can activate it by clicking the little document icon that is present on the address bar after you load a page which has a recognizable content/article part

                                          1. 2

                                            Oh, I’m sorry about that. I tried increasing the opacity, since I didn’t realize that that was a problem.

                                          1. 3

                                            One of the benefits of an open struct is that you can assign to values many layers deep, which I don’t think this proposes to do. But still looks great!

                                            1. 2

                                              to be honest I’m mainly using those as read-only structures so I didn’t try the assigns too much but it works fine

                                              user = SimpleHash[name: "a"]
                                              user[:name] = { prefix: "a", suffix: "b" }
                                              user.name.prefix # => "a"
                                              

                                              I could have direct setters like name= but I prefer it without the setters for now

                                            1. 7

                                              The guy’s actual CSS is a lot more than 58 bytes though :(

                                              1. 5

                                                (author here) True. By looking great nearly everywhere, I mean the layout of the elements on most devices/viewports.

                                                1. 7

                                                  I was about to post this as a positive thing! It’s still tiny, understandable, and looks great.

                                                1. 7

                                                  There are web frameworks in OCaml, Oscigen being the most mature. But there are also other typed functional languages with web frameworks! Servant is a new one in Haskell, but there are others, same goes for F# and Scala.

                                                  I don’t think that types and functional programming are just missing a good web framework to win the day. Web frameworks are fundamentally building GUIs; they just so happen to be GUIs downloaded on the fly. And GUI programming has historically been the least typeful sort of programming. Why would I need a compiler to tell me that I’m write when I can see right here I am? There’s a lot to be said for confidence in refactoring and ease of checking, but it’s not quite as necessary as it is for systems programming, distributed systems, etc.

                                                  That said, there is a lot of cool new stuff going on in the Elm / Virtual Dom space — and OCaml’s certainly part of it.

                                                  1. 6

                                                    I wouldn’t call Servant a web framework. It’s more for building APIs - you don’t get templating or any other MVC niceties that you’d get with Rails. Instead, you get typed, declarative APIs that in some cases you can then use to generate client code or documentation.

                                                    1. 4

                                                      Why would you say GUI are any less “typeful”? How are you seeing that you are right? Maybe on perfectly static pages I could see that it might be easy to visually check the page but most pages are not strict static HTML pages. I’ve been using Giraffe + Fable-Elmish for my F# webdev, this lets me have types in my client and server. Having the same data representation on the client and server allows me to have very simple client side validation, while also potentially having the same validation on my server. I can use the same code for both client and server.

                                                      1. 3

                                                        Yeah I don’t think that GUI’s are inherently typeful or not: Just pointing out that historically most GUIs have been written in dynamically typed programming languages: Javascript, Tcl, Ruby on Rails. Even some statically typed frameworks like vala/gobject and objective c have like an “Any” type. My guess is that this tendency is because it’s a lot easier to manually test GUIs, even ones that aren’t static, than it is to manually test distributed systems, kernels, compilers, etc. I’m not saying though that types aren’t useful for writing GUIs too though: having statically checked data across your server and client is awesome — your F# stack sounds great!

                                                        1. 1

                                                          I see! you weren’t meaning that they are inherently typeful or non typeful, you were describing the languages that are used for front end. That makes a lot more sense. I think part of it is that for a long time front end dev was seen as needing to be accessible to designers. Types have had a reputation as being “hard” because they tell you when you’ve boned it up, and that sometimes comes across as harsh I think. However really a good type system is like bowling with bumpers.

                                                      2. 2

                                                        If servant is like Erlang’s Webmachine or Clojure’s Liberator than there is a pretty decent alternative: webmachine. I’ve used it and the biggest learning curve was the OCaml object system.

                                                      1. 2

                                                        The promise of effects that I’m excited about isn’t so much the ability to express commonly built-in language features in terms of effects with continuations, but instead the ability to analyze statically the effects a particular function performs: in other words having effects built into the type system. This isn’t seen in closure but is quite cool.

                                                          1. 1

                                                            is it a light theme 😆

                                                            1. 1

                                                              Haha well I use it with set backdround=light

                                                          1. 19

                                                            I really dislike it when people make posts telling developers they should do something. How about instead “Rust: Several reasons why you might like to learn in it 2019”.


                                                            Rust’s low overhead is a good fit for embedded programming

                                                            ≠ you should learn it

                                                            Rust can build powerful web apps

                                                            ≠ you should learn it

                                                            Rust is good for building distributed online services

                                                            ≠ you should learn it

                                                            Rust is suited to creating powerful, cross-platform command-line tools

                                                            ≠ you should learn it

                                                            Rust now has new developer tools and better IDE support

                                                            ≠ you should learn it

                                                            That said, I’ve really enjoyed learning Rust, it’s a great language.

                                                            P.S. Autoplay on videos WITH sound? So annoying.

                                                            1. 14

                                                              I rarely just post to confirm, but I’d like to press that this is also very much the official project stance. It’s condescending, and we don’t think that helps.

                                                              We sve problems and prefer speaking to people that actually have these problems. Also, there’s alternatives and we believe people should check themselves.

                                                            1. 5

                                                              Common Lisp is probably quite unique in the fact that it’s both typically compiled to machine code and yet maintains enough runtime information to be considered “dynamic”. An implementation that is easy to study is valuable.

                                                              1. 1

                                                                There are several languages that have static type systems and keep type information around at runtime: go, java, typescript. So I think type erasure is a quality of the implementation, not the language per se. It’s still definitely cool that common lisp goes to machine code! Using the same tactic you could imagine compiling any dynamically typed language down to machine code too, although most things would probably still be quite slow

                                                                1. 1

                                                                  I would imagine in many dynamic languages type inference will do a decent job. Especially if as in Common Lisp you can aid by sparsely declaring types here and there. Though I could see how many optimizations in e.g. Ruby could be problematic.

                                                              1. 5

                                                                I actually worked at Uber 3 years ago – on those very endpoints! I might have even done the “max 50 results per page” but can’t be certain. Fun to see it used in the wild :)

                                                                1. 4

                                                                  I can definitely recommend inventing your own programming language and then solve Advent of Code problems with it.

                                                                  ❤️

                                                                  1. 7

                                                                    Pierce’s Types and Programming Languages has accompanying source code and covers adts

                                                                    1. 1

                                                                      Thanks! I have the book. It’s a great book by the way!

                                                                    1. 22

                                                                      Haskell, at its core, is simple: it is just a polymorphic lambda calculus with lazy evaluation plus algebraic data types and type classes.

                                                                      None of those things are simple :/

                                                                      1. 8

                                                                        algebraic datatypes are an extremely simple and beautiful thing; they’re just unfamiliar. one of the things i’m excited about pyret potentially doing is making them a standard part of an introduction to programming course.

                                                                        1. 6

                                                                          Algebraic datatypes are awesome! Pyret’s also super cool. Yeah I don’t think they’re particularly complicated to explain, but their actual implementation isn’t that simple when it comes to type inference, pattern matching, and recursive datatypes.

                                                                          1. 2

                                                                            ah, my mistake, sorry. i didn’t realise you meant in terms of implementation; i thought you were picking on haskellers for calling unfamiliar language features “simple”.