Newest Comments

  1.  
    1.  

      I think it’s nice.

      1.  

        if you already know

        This is a massive cart before the horse, ugh.

        Signals in Godot are a bad idea at large-scale because they’re slow. The only way you’d know that signals are a bad idea were if someone were to tell you something like “signals are 10x slower than a virtual function, so be careful to swap them out if they start generating too frequently”, in which case OP’s link would be mighty useful!

        This post has relevance in the specific application of Godot Engine games, which has several different mechanisms shown prominently and it can be hard to tell which one is appropriate. It’s very much apples-to-apples there.

        1.  

          I’m doing a little side project that involves linting Makefiles and one thing I could use is a Makefile parser. The linked project has a simple parser, but I’ve been unable to find anything more comprehensive.

          Suggestions welcome.

          1.  

            What an unfortunate logo.

            1.  

              Annoying. I wanted to see what else the guy has made on github, but his profile is empty

              1.  

                Is the point the centre or top left or something else?

                1.  

                  They denote that the function has side effects. I actually think it’s quite interesting as an approach to make it clear at a glance if a function is pure!

                  1.  

                    I expect you must be talking about something different than what I am talking about. The mechanism I described is extremely cheap; passing in a size would not be cheaper.

                    (Beyond which, performance is a bit irrelevant; my point was simply that it is not necessary to keep such metadata, not that it is necessarily desirable. Allocator design is complex and subtle, and mired with application-level concerns. My goal was not to give a sample design for a high-performance, general-purpose allocator.)

                    1.  

                      Yes, but small region check is not cheap at all. 30% CPU overhead I quoted above is for such small region check design. Fast paths of modern malloc is so fast that check cost is not trivial.

                      1.  

                        The thing is, isn’t every language feature beyond the bare minimum of what makes a language turing-complete syntax sugar?

                        I generally think of syntactic sugar as language features that could be implemented using macros. This definition by @Loup-Vaillant adds some more precision. I do think it is a useful thing to bear in mind as language designers, as a way of reducing the complexity of programming languages.

                        1.  

                          I find the Euler identity most elegant in its full form.

                           𝑖𝑥
                          𝑒   = cos(𝑥) + 𝑖 sin(𝑥)
                          
                          1.  

                            Posits are meant to represent approximations of members of ℝ, the Real numbers. Therefore, it doesn’t make sense to include representations for things that aren’t members of ℝ.

                            1.  

                              I said “often”, not “always”.

                              drawCircle(Point2, Vector2)
                              
                              1.  

                                Yes, if you control the application you can enable the regexp extension by yourself in the sqlite build, or, if you rely on another libsqlite distribution you can override the regexp everytime you start the application, e.g. in python, it’s easy to plug in re module’s search as a user defined function with a wrapper, see for example how django does it (ctrl + f ‘regex’)

                                https://github.com/django/django/blob/e30d6678421b7573a1995f61521f14348c9b2a17/django/db/backends/sqlite3/_functions.py#L41

                                1.  

                                  Ah, I see: it’s include in the command-line tool, but not available (by default) for library usage:

                                  $ sqlite3 :memory: "select 'foo' regexp 'o'"
                                  | 'foo' regexp 'o' |
                                  |------------------|
                                  | 1                |
                                  $ python3 -c "import sqlite3; c = sqlite3.connect(':memory:'); c.execute(''' select 'foo' regexp 'o' ''');"
                                  Traceback (most recent call last):
                                    File "<string>", line 1, in <module>
                                  sqlite3.OperationalError: no such function: regexp
                                  

                                  That makes SQLite more convenient for interactive use, but it’s a pain if I want to distribute data in SQLite-format databases, since I can’t assume the target application will have a matching configuration of SQLite.

                                  1.  

                                    You do not necessarily need to save metadata.

                                    For example, consider the following allocator design: a large region of address space is reserved for small allocations. (Large allocations can be mmapped and have their metadata in a hash table or something; whatever.) The small allocations space is divided into chunks of, say, 64k each—some medium-ish power of two—and each chunk is carved up into a freelist for allocations of some size class. The ‘next’ pointer for each freelist can either be at the base of its chunk, or in some separate array indexed by the high bits of the chunk base pointer (latter is more space-efficient and protects integrity of heap internal data structures from user buffer overflows, but whatever). Then ‘free’ can begin with a cheap check that the pointer freed is in the small region; if it is, then it can do all it needs to simply by chucking the low bits of the pointer. It is then unnecessary to save metadata for every allocation.

                                    1.  

                                      https://www.sqlite.org/changes.html

                                      2021-06-18 (3.36.0), they started shipping their implementation by default on CLI builds:

                                      The REGEXP extension is now included in CLI builds

                                      1.  
                                        void draw_circle(float, float, float, float)
                                        
                                        bool authenticate(string, string, string)
                                        

                                        I love IDE support for telling me what parameters are.

                                        1.  

                                          What’s up with the exclamation marks? For me they interrupt the flow of reading the code.