Threads for softinio

  1. 6

    Everywhere I have worked I have been forced to use Atlassian Confluence, but if I had to choose and I could choose anything I want at any cost, I would use https://www.craft.do/ .

    If you are looking for an open source option guess look at some of the self hosted wiki options such as:

    https://js.wiki/

    https://www.dokuwiki.org/dokuwiki

    https://www.mediawiki.org/wiki/MediaWiki

    https://www.bookstackapp.com/

    I haven’t used any of them myself to give a recommendation.

      1. 6

        I have been on the lookout for an indentation based language to replace Python for some time now as an introductory language to teach students. Python has too many warts (bad scoping, bad implementation of default parameters, not well-thought-out distinction between statements and expressions, comprehensions are a language within the language that makes student’s life difficult, and so on.). Is Nim the best at this point in this space? Am I missing warts in Nim that makes the grass greener on the other side? Anyone who has experience with both Nim and Python, can you tell me what the trade-offs are?

        1. 9

          I am uncomfortable with statements like (from this article) “if you know Python, you’re 90% of the way to knowing Nim.” The two languages are not IMO as similar as that. It’s sort of like saying “if you know Java, you’re 90% of the way to knowing C++.” Yes, there is a surface level syntactic similarity, but it’s not nearly as deep as with Crystal and Ruby. Nim is strongly+statically typed, doesn’t have list comprehensions, doesn’t capitalize True, passes by value not reference, has very different OOP, etc.

          That said, there’s definitely evidence that Nim has a smooth learning curve for Pythonistas! This isn’t the first article like this I’ve read. Just don’t assume that whatever works in Python will work in Nim — you don’t want to be like one of those American tourists who’s sure the locals will understand him if he just talks louder and slower :)

          So yes, Nim is excellent. It’s quite easy to learn, for a high performance compiles-to-machine-code language; definitely easier than C, C++ or Rust. (Comparable to Go, but for various reasons I prefer Nim.) When programming in it I frequently forget I’m not using a scripting language!

          1. 2

            Thank you for your perspective. Much appreciated.

            1. 1

              passes by value not reference

              The terminology here is very muddied by C, so forgive me if this sounds obvious, but do you mean that if you pass a data structure from one function to another in Nim, it will create a copy of that data structure instead of just passing the original? That seems like a really odd default for a modern language to have.

              1. 4

                At the language level, it’s passing the value not a reference. Under the hood it’s passing a pointer, so this isn’t expensive, but Nim treats function arguments as immutable, so it’s still by-value semantically: if I pass an array or object to a function, it can’t modify it.

                Obviously you don’t always want that. There is a sort-of-kludgey openarray type that exists as a parameter type for passing arrays by reference. For objects, you can declare a type as ref which makes it a reference to an object; passing such a type is passing the object by reference. This is very common since ref is also how you get dynamic allocation (with GC or more recently ref-counting.) It’s just like the distinction in C between Foo and *Foo, only it’s a safe managed pointer.

                This works well in practice (modulo some annoyance with openarray which I probably noticed more than most because I was implementing some low-level functionality in a library) … but this is going to be all new, important info to a Python programmer. I’ve seen this cause frustration when someone approaches Nim as though it were AOT-compiled Python, and then starts either complaining or asking very confused questions on the Nim forum.

                I recommend reading the tutorial/intro on the Nim site. It’s well written and by the end you’ll know most of the language. (Even the last part is optional unless you’re curious about fancy stuff like macros.)

                (Disclaimer: fate has kept me away from Nim for about 6 months, so I may have made some dumb mistakes in my explanation.)

                1. 4

                  Gotcha; I see. I wonder if it’d be clearer if they just emphasized the immutability. Framing it in terms of “by value” opens up a big can of worms around inefficient copying. But if it’s just the other function that’s prevented from modifying it, then the guarantee of immutability isn’t quite there. I guess none of the widely-understood terminology from other languages covers this particular situation, so some new terminology would be helpful.

            2. 5

              Python has too many warts (bad scoping, bad implementation of default parameters

              I don’t want to sound like python fanboy, but those reasons are very weak. Why do you need to explore the corner cases of scoping? Just stick to a couple of basic styles. Relyokg on many scoping rules is a bad idea anyways. Why do you need default parameters at all. Many languages have no support for default parameters and do fine. Just don’t use them if you think their implementation is bad.

              Less is more. I sometimes flirt with the idea of building a minimal indendtation based language with just a handful of primitives. Just as a proof of concept of the practicallity os something very simpl and minimal.

              1. 7

                At least for python and me, it’s less a matter of exploring the corner cases in the scoping rules and more a matter of tripping over them involuntarily.

                I only know three languages that don’t do lexical scoping at this point:

                1. Emacs lisp, which does dynamic scoping by default for backwards compatibility but offers lexical scoping as am option and strongly recommends lexical scoping for new code.

                2. Bash, which does dynamic scoping but kind of doesn’t claim to be a real programming language. (This is wrong but you know what I mean.)

                3. Python, which does neither dynamic nor lexical scoping, very much does claim to be a real programming language, and has advocates defending its weird scoping rules.

                I mean, access to variables in the enclosing scope has copy on write semantics. Wtf, python?

                (Three guesses who started learning python recently after writing a lexically scoped language for many years. Thank you for indulging me.)

                1. 4

                  It is weirder than copy on write. Not tested because I’m on my iPad, but given this:

                  x = 1
                  def f(cond):
                     if cond:
                        x
                     x = 2
                  

                  f(false) does nothing, but f(true) will thrown an undefined variable exception.

                  1. 4

                    I think you need nonlocal x but I don’t quite get why this is weird/nonlexical.

                    It has lexical scoping but requires you mark variables you intend to modify locally with ‘nonlocal’ or ‘global’ as a speed bump on the way to accidental aliasing. I don’t think I’d call puthon “not lexically scoped”

                    1. 3

                      Have you tried declaring a variable inside an if?

                      if True:
                          X = 1
                      print(X)
                      
                      1. 1

                        Yeah, if doesn’t introduce scope. Nonlexical scope doesn’t IMO mean “there exist lexical constructs that don’t introduce scope”, it is more “there exist scopes that don’t match any lexical constructs”

                        1. 2

                          I just learned the idea of variable hoisting thanks to this conversation. So the bizarre behavior with carlmjohnson’s example can be understood as the later assignment declaring a new local variable that comes into scope at the start of the function. Because python does block scope instead of expression scope.

                          I guess I’ve been misusing “lexical scope” to mean expression-level lexical scope.

                          I still find the idea of block scope deeply unintuitive but at least I can predict it’s behavior now. So, thanks!

                          1. 1

                            Yeah I’m not a huge fan either tbh, but I guess I’ve never thought of it as weird cause JavaScript has similar behavior.

                      2. 2

                        I agree. This is more of a quirk due to python not having explicit variable declaration syntax.

                        1. 2

                          It’s multiple weird things. It’s weird that Python has† no explicit local variable declarations, and it’s weird that scoping is per function instead of per block, and it’s weird that assignments are hoisted to the top of a function.

                          † Had? Not sure how type declaration make this more complicated than when I learned it in Python 2.5. The thing with Python is it only gets more complicated. :-)

                          Different weird thing: nonlocal won’t work here, because nonlocal only applies to functions within functions, and top level variables have to be referred to as global.

                    2. 3

                      JavaScript didn’t have it it either until the recent introduction of declaration keywords. It only had global and function (not block) scope. It’s much trickier.

                      But I am puzzled with why/how people stumble up on scoping problems. It doesn’t ever happen to me. Why do people feel the urge of accessing a symbol on a block outside the one when it was created? If you just don’t do it, you will mover have a problem, on any language.

                      1. 1

                        For me it’s all about closures. I’m used to using first class functions and closures where I suspect an object and instance variables would be more pythonic.

                        But if you’re used to expression level lexical scope, then it feels very natural to write functions with free variables and expect them to close over the thing with the same name (gestures upward) over there.

                        I’m curious, do you use any languages with expression level scope? You’re not the first python person I’ve met who thinks pythons scope rules make sense, and it confuses me as much as my confusion seems to confuse you.

                        1. 2

                          I don’t need to remember complicated scoping rules because I don’t ever use a symbol in a block higher up in the tree than the one it is defined in. Nor do I understand the need to re-assign variables, let alone re-using their names. (Talking about python now). Which languages qualify having expression level scope? Is that the same as block scope? So… Java, modern JavaScript, c#, etc?

                          I am confused. What problems does python pose when using closures? How is it different than other languages in that respect?

                          1. 1

                            I use closures in python code all the time. I just tend not to mutate the free variable. If you do that, then you don’t need to reference the free variable as global or nonlocal. If I was mutating the state then I might switch over to an object.

                    3. 5

                      Nim is pretty strongly typed, that is certainly different from Python. I’m currently translating something with Python and Typescript implementations, and I’m mostly reading the Typescript because the typing makes it easier to understand. With Nim you might spend time working on typing that you wouldn’t do for Python (or not, Nim is not object oriented), but its worth it for later readability.

                      1. 4

                        Nim is less OO than Python, but more so than Go or Rust. To me the acid test is “can you inherit both methods and data”, and Nim passes.

                        Interestingly you can choose to write in OO or functional style, and get the same results, since foo(bar, 3, 4) is equivalent to foo.bar(3, 4).

                        IIRC, Nim even has multimethods, but I think they’re deprecated.

                        1. 2

                          what? don’t you mean foo(bar, 3, 4) and bar.foo(3, 4)? AFAIK the last token before a parenthesis is always invoked as a function.

                          1. 1

                            Oops, you’re right!

                          2. 1

                            what? don’t you mean foo(bar, 3, 4) and bar.foo(3, 4)? AFAIK the last token before a parenthesis is always invoked as a function.

                        2. 3

                          Latest release of Scala 3 is trying to be more appealing to Python developers with this: https://medium.com/scala-3/scala-3-new-but-optional-syntax-855b48a4ca76

                          So I guess could make it an option.

                          1. 2

                            Thanks!, this certainly looks interesting. Would it make an introductory language, though? By which I mean that I want to explain a small subset of the language to the pupil, and that restricted language should be sufficient to achieve fairly reasonable tasks in the language. The student should then be able to pick up the advanced concepts in the language by self exploration (and those implementations should be wart free. For example, I do not want to explain again why one shouldn’t use an array as a default parameter value in Python).

                            1. 2

                              There is no such thing as a programming language that is “wart free”, and while initially you want to present any language as not having difficulties or weirdness, in the long run you do need to introduce this to the student otherwise they will not be prepared for “warts” in other languages.

                          2. 1

                            Depending on what you’re trying to teach, Elm does fit your description of an introductory language for teaching students that uses indentation. I know there’s a school that uses Elm for teaching kids how to make games, so it definitely has a presedence for being used in education too. Though, of you’re looking to teach things like file IO, http servers, or other back end specific things then it’s probably a poor choice.

                          1. 2

                            The other provider I had come across is https://posteo.de/en thought I share in case useful to anyone. Have not used myself yet.

                            1. 15

                              I’ve had a great experience with Nix

                              1. 6

                                I have also had good experiences with Nix, but I share the same sentiment as the OP. When Nix works out of the box it’s amazing, but I end up investing a non-trivial amount of time making the edge cases work as well.

                                I have also not been able to resolve a few problems in a short amount of time and instead reverted to the system package manager for those packages.

                                For me it’s still a strong step towards declarative management, but I am not willing to invest the time required to learn Nix thoroughly, so the edge cases are rough.

                                (Using Home Manager on Debian)

                                1. 4

                                  Out of curiosity, what sort of edge cases have you ran into?

                                  1. 4

                                    I don’t remember all of them, but I kept a list of things I’ve “escaped” Nix for here: https://github.com/azuline/dotfiles#broken.

                                    (nixpkgs doesn’t actually suck)

                                    1. 2

                                      ah yeah I wouldn’t even wanna attempt to package calibre lol

                                2. 2

                                  100% agreed. Highly recommend Nix.

                                1. 1

                                  I recently came across this which looks good to me for your use case especially as Privacy is one of the features you have listed:

                                  https://posteo.de/en

                                  1. 1

                                    This looks like a email service provider. Although it includes 2 free aliases per account, it is not a forwarding service primarily. What I want is to create/remove/block aliases and set them up to forward emails to a primary email account of my choice.

                                    1. 1

                                      Out of interest, why do you not want to self-host this? Dovecot can run on a very cheap VPS unless it’s getting a huge volume of email and it’s trivial to set up catchall redirects and then use sieve rules to reject any that you’ve decided to block. SMTP provides fail-over via backup MX records, so a couple of $5/month VPSs would be fine for this.

                                  1. 9

                                    This exact problem had plagued me for so long and it is so annoying. It was pretty much the final straw that made me move back to MacPorts.

                                    1. 6

                                      Similar issues are what sent me to nix.

                                      1. 2

                                        100% Agreed regarding Nix!

                                        My current home setup is Nix for everything & MacPorts for things I can’t get on Nix yet.

                                        1. 2

                                          I’ve been experimenting with Nix too. It’s nice, although port is so simple to use, whereas nix-env feels clunky/complicated in a very rpm way and the Nix language is… not straightforward :-)

                                          1. 2

                                            Yeah, nix-env is super clunky. I never use it unless I have to. I’ve got everything built declaratively. Nix the language definitely takes a minute to onboard, agreed.

                                            1. 1

                                              Last time I try it, I got oom.

                                        2. 3

                                          Agreed! There a lot of good things about MacPorts.

                                          1. 1

                                            Why did you migrate to Homebrew in the first place?

                                            1. 9

                                              Good question, and one to which I don’t really remember the answer. I’ve been using MacOS since 10.3 and had tried both Fink and MacPorts in the early days. My vague memory of both in the early days was they were fairly clunky, but Homebrew just worked.

                                              Homebrew has since morphed into this huge, slow thing that has become pretty annoying to use, whereas MacPorts now feels fast and slick in comparison.

                                              1. 4

                                                Yeah. It feels like with this and other changes made over the last few years, Homebrew is coming close to falling off the back of the package manager treadmill.

                                                Homebrew in its early days was good because it was lightweight, fast (for (as it was then) a package manager that could only build from source, at least), didn’t try to do stuff that was too clever, and also acquired a fairly nice and large package library fairly quickly thanks, I think, to a relaxed contribution policy that didn’t require individuals to take complete responsibility for packages. (I don’t know if Max Howell explicitly realized that keeping a package manager up to date with new versions of packages would be something a whole user community could do together if it were made easy enough, or if it just happened to work out like that, but in any case it did work very well in practice.)

                                                Now it insists on automatically refreshing the package index every. time. I. do. anything. which makes startup slow, and is also doing this too-clever-by-half thing of trying to work out which packages I actually wanted to install and which just came along for the ride as dependencies. (Which isn’t how humans work: if one day I type ffmpeg and it happens to be there, it’s not necessarily clear to me that I only have it because I installed get_iplayer and it brought ffmpeg along, rather than having installed it myself explicitly on some now-forgotten date in the past. Computers have a far better memory for why things are installed than humans do, and humans will always get confused when things change because of implicit rules based on the computer’s perfect recall.) Meanwhile it’s also got stupider in some other ways, such as no longer being able to do builds from source with custom ./configure options etc.

                                                I have similar memories of MacPorts being a pain to use, but who knows? It’s been ten years or something now. Maybe it’s worth another look.

                                              2. 3

                                                I’ve been a FreeBSD user for a while so MacPorts always fit better for me. If my memory is correct, Homebrew had an initial learning curve that was shallower than the curve for MacPorts back in the day.

                                            1. 1

                                              I recently came across this: https://frontpagelinux.com/

                                              1. 2

                                                I have been using IRC via Matrix.org and element.io client. Works well.

                                                https://element.io/

                                                https://matrix.org/

                                                1. 1

                                                  One thing I always wondered: when logging in through nickserv, does Element/Matrix store your IRC credentials in plain text?

                                                  1. 1

                                                    I can’t see how they would avoid this.

                                                  2. 1

                                                    Likewise

                                                  1. 1

                                                    Nice write up. I used to be a user of Cerberus but since than have moved to using pydantic (https://pydantic-docs.helpmanual.io/) which fits in well with my workflow of using mypy everywhere.

                                                    1. 2

                                                      Maybe this is a silly question because I don’t use Scala, but after ~15 minutes of searching their website, I don’t know why this is a big deal or what’s new in Scala 3.

                                                      python.org has links to pre-release downloads, and version N+1 documentation right on their site, and I don’t see anything like that.

                                                      Anybody know what’s new in 3? Anything exciting?

                                                      1. 5

                                                        As Scala 3 is not officially release yet its most up to date documentation on it can be found here: https://dotty.epfl.ch/

                                                        The great news is a lot of existing book authors and new ones are working releasing new books and docs in time for its release.

                                                        Personally I am very excited for scala3. Also I am excited about how the language, its eco system has grown in demand, tools and new learning resources over the last one year.

                                                        If you want to have a look at some of the new ideas coming with scala 3 , I personally really enjoyed the following talks:

                                                        https://www.youtube.com/watch?v=UQ5Q-HxuU_U

                                                        https://www.youtube.com/watch?v=8H9KPlGSBnM

                                                        https://www.youtube.com/watch?v=J-KDLrdlg78

                                                        1. 4

                                                          Scala 3 overhauls implicit, and it is exciting and quite a big deal.

                                                          1. 2

                                                            Maybe this is a silly question because I don’t use Scala, but after ~15 minutes of searching their website, I don’t know why this is a big deal or what’s new in Scala 3.

                                                            Don’t worry, the documentation on the website pretty much hasn’t been updated in like 10 years.

                                                            I don’t think it will be for version 3, either.

                                                            Anybody know what’s new in 3? Anything exciting?

                                                            They flipped their definition of simplicity from “as few orthogonal building blocks as possible” to “a language feature for each individual use case”, and added a few dozen new features.

                                                            Opaque types is my favorite in terms of worst language design.

                                                            1. 4

                                                              If the main purpose is to setup VPS and remote servers, I would consider NixOS where you can automate everything including the OS in a declarative way.

                                                              1. 2

                                                                I want to look into it some day.

                                                              1. 8

                                                                If all you want is a reasonable, mature, production-oriented language on the jvm, it seems hard for me to see the appeal of scala compared to Kotlin. As far as I know tooling for kotlin is already as good, or better than scala’s (at least on the IDE side). I’d love to be proven wrong of course.

                                                                1. 4

                                                                  I think the core difference in the development of Scala and Kotlin is that Scala largely focused on improving things were already good, while Kotlin worked on fixing the worst parts of Scala.

                                                                  If you only compare the language subset that both Kotlin and Scala share, it’s painfully obvious that Scala is pretty much better all across the board – but as it turned out – that’s entirely irrelevant if Scala can’t manage to have reliable IDE support after 15 years.

                                                                  1. 4

                                                                    Scala does have reliable IDE support. The IntelliJ plugin works fine.

                                                                    1. 2

                                                                      ‘Fine’ is a relative term. Last time I used it, it was slow as molasses on a relatively big project. A few of my coworkers had adopted a workflow of doing most edits in Vim (or any other editor), then update the file in IntelliJ and take care of lints or suggestions.

                                                                      That was a few years ago, but Scala itself had barely changed since then, so I’m wondering if the IDE experience got any better.

                                                                      1. 2

                                                                        So you’re talking about your experience a few years ago, I understand. It’s definitely gotten better and continues to.

                                                                        1. 2

                                                                          I’m wondering if repo size also affected performance. This was a sizable, but by no means crazy, repo maintained by very clever people. What I mean by that is that there was a lot of code that took advantage of Scala’s type system (for example, it was my first encounter with the cake pattern). My overall experience with Scala was I loved the language, but even at the time the rift with Scalaz and the perceived stagnation of the actual Scala language felt a bit… weird. Glad things got better. Definitely happy to take another look once Dotty is out.

                                                                      2. 1

                                                                        Usually, and only very recently. As long as the types don’t get too complex, no macros are used etc.

                                                                        Not to mention that the Eclipse plugin is pretty much dead, and the ENSIME creator has also thrown in the towel.

                                                                      3. 3

                                                                        Scala IDE / text editor support is fabulous. Loving using Metals with Neovim as my daily driver. I also use Intellij occasionally and the scala plugin is truly impressive.

                                                                        Scala tooling is amazing. Fabulous these days.

                                                                      4. 4

                                                                        Scala as a language, has many great features that Kotlin doesn’t. Kotlin doesn’t have HKT for instance. Both are great productive languages. Tooling support is not the sole factor to choose a language over.

                                                                        1. 5

                                                                          Tooling, onboarding, being able to understand code found in the wild, these are things that Kotlin has over scala imho. Scala is like C++, Kotlin a bit more like Go, in this regard: sure Scala has more features, but it doesn’t necessarily play in its favor.

                                                                          1. 3

                                                                            yeah, I wouldn’t disagree, onboarding is harder than it needs to be. The linked article is actually about that and improving that, in the later half.

                                                                      1. 2

                                                                        I am glad to see RethinkDB evolving, but out of interest who are its maintainers?

                                                                        1. 5

                                                                          I must admit I find it surprising there is no mention of Programming in Haskell by Graham Hutton for me this was the best way to learn Haskell.

                                                                          1. 4

                                                                            Yea, that book along with Richard Bird’s book would be my goto choice for a concise beginner Haskell book.

                                                                          1. 2

                                                                            I like the idea behind this, couple of questions about it:

                                                                            1. If my python service is scaled to run on multiple containers how well will this work across containers with sqlite?
                                                                            2. Are there any plans to support redis as the store?
                                                                            1. 2

                                                                              Thanks!

                                                                              1. I’ve been using it mostly in single consumer mode or they were spaced apart in time so concurrency was never an issue. I did discover some concurrency issues and just fixed them and released new version.

                                                                                So it should work correctly now, and worst case is if two concurrent processes have mismatched cache and want to start writing – in that case one of them ‘wins’ and updates the cache and another one simply calls the function without modifying the database.

                                                                              2. I’ve never thought of it, however, I can see how it could be useful!

                                                                                Should be relatively straighforward: the bit responsible for converting into sqlite-compatible row is separated from code actually dealing with sqlite. So it would be a matter of providing different primitive type mapping (in redis everything is a string iirc?) and implementing transactional logic for Redis (which I’m less familiar with than sqlite).

                                                                              1. 2

                                                                                Awesome great. For sure will take a closer look and use your project when I can.

                                                                                Created this issue from our conversation: https://github.com/karlicoss/cachew/issues/9

                                                                                Short of bandwidth at the moment but if one day I have some time will contribute above to your project if you don’t get to it first :-)

                                                                            1. 2

                                                                              G Suite / Google apps

                                                                              1. 4

                                                                                Personally I still prefer my neovim setup for python development, but I do agree with this blog on VS Code being a better option these days than Sublime Text.

                                                                                1. 3

                                                                                  Hi I’m Salar and I write about Scala, Python and related technologies. I am planning on writnig one blog per week going forward to make up for not blogging much last few years so look forward to having more readers and engaging with more people

                                                                                  Link: https://www.softinio.com/