News for hackers. Stuff that matters.

mortoray

Re:The string type is broken (2013) on Wednesday June 23, 2021 @01:46AM (#27601159)
It's a bit disappointing that a relatively new language like Rust doesn't handle these correctly.

There's no value in a String type if it doesn't behave for text. One can simply use a "Array<char>" to convey proper semantic meaning.

Re:The string type is broken (2013) on Wednesday June 23, 2021 @01:45AM (#27601154)
It's not about reversing, but about checking whether reverse iteration works. This is required to perform proper truncation (for limited length fields) as well as visual editing for a cursor to go through the text.

It can additionally be an indication as to whether regular expression matching works, though that is usually handled by a library, and not the core string types.

My contention was always that if a "string" does not reverse text, then it's no better than an "array<char>". The existence of a "string" type implies it should do more.

Re:High-Throughput Game Message Server with Python WebSockets on Sunday December 06, 2020 @04:43AM (#25322349)
It'll probably help in this case since I suspect it's computational overhead introducing the bottleneck, nothing architectural.

Alas, I might have to wait, as I tend to use Python 3.8 and it's not supported yet -- though mainly I use it for types, it might actually run in 3.7

Re:High-Throughput Game Message Server with Python WebSockets on Sunday December 06, 2020 @04:35AM (#25322321)
I intend on adding WebRTC as a channel for higher volume discarble messages, such as the cursor position of all players.
Re:Why switch is better than if-else on Saturday June 29, 2019 @05:59PM (#20315056)
I agree. General purpose pattern matching in both expressions and function dispatch is a great feature.
Re:A Failed Experiment with Python Type Annotations on Tuesday June 11, 2019 @05:10PM (#20159575)
Great!
Re:I don’t know how to create a website on Sunday August 26, 2018 @09:57AM (#17845950)
I do not have a good reason. A lot of my recent stuff isn't technical, so it's only on the Medium pages. I guess I tend to post those links often now.
Re:Sadly, I must say goodbye to Leaf, my programming language on Wednesday August 08, 2018 @05:16AM (#17714236)
I chose LLVM from the start since I knew some of the challenges that interested me couldn't be done at the C level -- or rather it'd be more complicated at that level than at the LLVM level.
Re:Sadly, I must say goodbye to Leaf, my programming language on Wednesday August 08, 2018 @03:37AM (#17713897)
Thank you.
Re:Sadly, I must say goodbye to Leaf, my programming language on Wednesday August 08, 2018 @03:33AM (#17713885)
When I started Leaf it was to scratch an itch. It was really only when the motivation dropped that I tried to find ways to use it, to renew my interest in pursuing it.
Re:Sadly, I must say goodbye to Leaf, my programming language on Wednesday August 08, 2018 @03:32AM (#17713881)
Perhaps that did not come across in the article well. When I set out to do Leaf that was the goal of the work. It's wasn't a diversion to some other goals. Over time my priorities changed, and I was trying to force myself to follow Leaf to follow them.

Had I wanted to make a game from the start I would most certainly not have made a language first! That would be crazy. And that's my comments about sunk costs -- just because I have Leaf, it'd still be crazy to do this other projects in it.

Re:Should function arguments be reassignable or mutable? on Monday January 01, 2018 @09:59AM (#16046265)
I, the author, am tending to agree now. :)
Re:Ride the carousel of folly with a Python migration on Tuesday January 24, 2017 @01:51AM (#13469342)
Okay, they are classified but I don't see that anything in the setup, or pip package management, seem to actually use them. Are they somehow used in actual package management, or just search qualifiers?
Re:Ride the carousel of folly with a Python migration on Tuesday January 24, 2017 @01:50AM (#13469338)
That is not an actual migration guide. It's merely a meta-doc saying what types of things you need to pay attention to. I was looking for a specific list of things that would have to be migrated. The docs mention of reading the release notes for each versino of Python 3 isn't very helpful.
Re:Ride the carousel of folly with a Python migration on Tuesday January 24, 2017 @01:49AM (#13469330)
The `iter` form of the `readline` doesn't load the entire stream first, whereas the second form you posted does. This makes a significant difference when reading data from another program.

I saw that migration guide, but it has very few details about what is actually involved in migration. It doesn't include API change details.

Re:Ride the carousel of folly with a Python migration on Tuesday January 24, 2017 @01:46AM (#13469317)
The simple syntax changes I did prior to running 2to3 as they came up on the first run I tried. The semantic changes that didn't come up in 2to3 is what I was more bothered about.
Re:Invented here syndrome (2015) on Monday October 10, 2016 @10:50AM (#12677365)
#1 has a big influence on my argument. I think it was Python and NodeJS library systems that made it super simple for people to publish libraries. There are a lot of trivial libraries out there, and many of questionable quality. Sometimes using a library ends up as more work than writing the bits of code myself.

It's not like I'm going to decide to write a new 20k line library for my project, but if something is only a few hundred lines of code it's definitely easier to just rewrite.

Re:Invented here syndrome (2015) on Monday October 10, 2016 @10:46AM (#12677333)
I (the author) can certainly do the silly algorithm tests, but whether I can contain my snide remarks enough to get the job is uncertain. :)
Re:Is reference counting slower than GC? on Tuesday May 24, 2016 @06:06AM (#11760169)
Those are some of the points I'm considering as well when doing the memory management for Leaf. My desire to have predictable destructors is tough to reconcile in a tracing GC.

I'm uncertain of what you mean with "copying the data over" in reference to large data. Surely it's still just the pointer being copied? Or are you speaking of things like `std::vector` in C++ that are value-copied by default?

Re:Is reference counting slower than GC? on Tuesday May 24, 2016 @06:03AM (#11760164)
In my quest for a memory management scheme on Leaf it's your final point which is primarily forcing my decision: the compatibility with other memory managers. In this article I just wish to provide counterpoint to those people trying to convince me that tracing GC is a better approach. In the end, it's the need to right libraries and be compatible that prevents me from using a complex GC.
Re:Is reference counting slower than GC? on Tuesday May 24, 2016 @05:51AM (#11760112)
In my conclusion I mention why there are no benchmarks, it's nearly impossible to construct a realistic comparison between the two techniques.

When I cosnider tracing GC my primary arguments against it have nothing to do with performance at all, yet it often comes up as an argument against my position. This article is attempting to address that critique, by saying I doubt you could compare the two directly.

Re:Is reference counting slower than GC? on Tuesday May 24, 2016 @05:47AM (#11760096)
I'm not sure how this disputes what I say about a scanning garbage collector. The number of live objects is proportional to the amount of total memory allocated.

I don't consider dead objects, where the memory is not longer used and free to be allocated, to be part of the allocated memory.

Re:Is reference counting slower than GC? on Tuesday May 24, 2016 @05:42AM (#11760084)
I (author) actually agree that reference counting is a form of garbage collection. However, in most dicussions about memory management the generic term garbage collection tends to refer to scanning collectors. In particualr, people who often oppose my views on scanning GCs are the ones that actually use the term garbage collector to refer to those types of collectors.

Most places I see talking about reference counting just say reference counting, sometimes mentioning memory management. Automatic memory management is perhaps the most generic term.

How reference counting actually works is covered in my previous article, which I wrote as a lead-up to this one. It covers the particulars of how memroy coherency is the primary cost of reference counting.

Re:The trouble with 'floor' and 'ceil' on Thursday January 07, 2016 @02:33AM (#10856539)
Yes, round is usually a safer choice, but in this case we had reasons to use floor and ceil, and thus had to deal with the issue.

I've added a section to the article with a more correct snapping function showing the issue more clearly (I hope).

Re:The trouble with 'floor' and 'ceil' on Thursday January 07, 2016 @02:31AM (#10856535)
Rounding to the nearest value does avoid the problem I had in the article. But we really wanted to `ceil` in this case, to guarantee an element is never smaller than a provided value (and doesn't end up as 0 size).
Re:The trouble with 'floor' and 'ceil' on Thursday January 07, 2016 @02:29AM (#10856529)
Python actually seems to show a much higher precision than other languages (higher than C's printf default I belive).

Interesting is that print can show an exact representation of any floating point value, but of course 0.1 can't be represented exactly.

Older »