← Back to context

Comment by wodenokoto

14 hours ago

I like the idea of a compiled language that takes the look and ethos of Python (or at least the "looks like pseudocode, but runs"-ethos)

I don't think the article gives much of an impression on how SPy is on that front.

I believe that Python is as popular and widely used as it is because it's old enough to have an expansive ecosystem of libraries. It's easy enough to implement one in pure Python and possible to optimize it later (Pydantic is a great recent-ish example, switching to a Rust core for 2.0). That same combination of Python + (choose a compiled language) makes it quite difficult for any new language to tap into the main strength of Python.

  • Python is popular because of it's expansive ecosystem of libraries, which only exist because the language is duck typed. If it was statically typed, the expansive ecosystem of libraries wouldn't exist.

    There is a factor of 3x difference in dev speed between the two typing systems.

  • It's not just its age, it's how easy it is (was?) to jump in and start writing useful code that could be revisited later on and be able to read it and understand it again.

    All of these efforts to turn it into another Typescript are going to, in the end, kill the ease of use it has always had.

This is what F# provides.

F# has a similar whitespace syntax to Python, but is statically typed and can be compiled AoT.

Bubble sort Python:

    mylist = [64, 34, 25, 12, 22, 11, 90, 5]

    n = len(mylist)
    for i in range(n-1):
      for j in range(n-i-1):
        if mylist[j] > mylist[j+1]:
          mylist[j], mylist[j+1] = mylist[j+1], mylist[j]

    print(mylist)


Bubble sort F#:

    let mylist = ResizeArray [ 64; 34; 25; 12; 22; 11; 90; 5 ]

    let n = Seq.length mylist
    for i = 0 to n - 2 do
      for j = 0 to n - i - 2 do
        if mylist[j] > mylist[j + 1] then
          let temp = mylist[j]
          mylist[j] <- mylist[j + 1]
          mylist[j + 1] <- temp

    printfn "%A" mylist

  • Nim:

      var mylist = [64, 34, 25, 12, 22, 11, 90, 5]
    
      let n = mylist.len
      for i in 0..n-2:
        for j in 0..n-i-2:
          if mylist[j] > mylist[j + 1]:
            swap(mylist[j], mylist[j + 1])
    
      echo mylist

You can have that today with Nim.

  • Nim feels like a really amazing language. There were some minor things that I wanted to do with it. Like trying to solve a codeforces question just out of mere curiosity to build something on top of it.

    I felt like although it was similar to python. You can't underestimate the python's standard library features which I felt lacking. I am not sure if these were skill issues. Yes these are similar languages but I would still say that I really welcome a language like SPy too.

    The funny thing is that I ended up architecting a really complicated solution to a simple problem in nim and I was proud of it and then I asked chatgpt thinking no way there can be anything simpler for it in nim and I found something that worked in 7-10 or 12* lines and my jaw dropped lol. Maybe chatgpt could be decent to learn nim imo or reading some nim books for sure but the packages environment etc. felt really brittle as well.

    I think that there are good features of both nim and SPy and I welcome both personally.

    • GPT is amazing at Nim. Ive used it to find a subtle bug in a macro that’s hundreds of lines of code.

  • There don't seem to be great web frameworks like Flask, Django, or FastAPI for Nim.