Hacker Newsnew | past | comments | ask | show | jobs | submit | marcianx's commentslogin

Can people register a subdomain of fl.us willy-nilly though? Isn't the root domain owned by the state?

From the RFC (note the "or businesses"):

   Name Space Within States:
   ------------------------

   "locality" - cities, counties, parishes, and townships.  Subdomains
   under the "locality" would be like CI.<city>.<state>.US,
   CO.<county>.<state>.US, or businesses. For example:
   Petville.Marvista.CA.US.

   "CI" - This branch is used for city government agencies and is a
   subdomain under the "locality" name (like Los Angeles). For example:
   Fire-Dept.CI.Los-Angeles.CA.US.
So you'd be counting on the sub-registrar of jacksonville.fl.us not to allow a registration for the fraudulent "business" of Sheriff, Inc. -- multiplied by every municipality across the country.

If the past is any indication, it's more likely that it'd get reset to "Office One".

Knowing the vendor, it’s Office Series X.

Office X series X 2

Office Forever

Agreed about POP Shop being slow. I recently learned that they were working on its replacement: "COSMIC store" (written in Rust + Iced), and it's super-fast. You can try it with `sudo apt install cosmic-store`.


Reference counted pointers can deference an object (via a strong pointer) without checking the reference count. The reference count is accessed only on operations like clone, destruction, and such. That being said, access via a weak pointer does require a reference count check.


This sounds different from common refcounting semantics in other languages, is it really so in Swift?

Usually access increases the reference count (to avoid the object getting GC'd while you use it) and weak pointers are the exception where you are prepared for the object reference to suddenly become invalid.


> Usually access increases the reference count

Taking shared ownership increases the reference count, not access.


When you have a strong pointer, you already have a positive ref count. Only once the strong pointer is destructed, is the reference count decremented.


And also the issue with checked exceptions is that one can't be generic over the checked exception, at least in Java. So it's impossible to write out a universally useful function type that's strictly typed on the error. This definition of `ThrowingFunction` for Java [1] needs just have `throws Exception`, allowing just about anything to be thrown.

Most functional-inspired languages would just have a single `f: T -> Result<U, E>` interface, which supports both (1) a specific error type `E`, which can also be an uninhabited type (e.g. never type) for an infallible operation, and (2) where `U` can be the unit type if the function doesn't return anything on success. That's about as generic as one can get with a single "interface" type.

[1]: https://docs.spring.io/spring-framework/docs/current/javadoc...


There are further bugs:

`for path in paths`

should be

`for (const path of paths)`

JS will immediately error on the lack of parens, but the `in` vs `of` iterates over indexes, not values, and those indexes are unfortunately converted to strings (since `for-in` is object field-name iteration). So even TypeScript would not have caught it when the (stringified) index is used as the first argument of `fs.watch()`.


I've found this to be a common Americanism, but it's still incorrect, I believe. When I moved to the US in my teens, I was surprised at the sheer disregard of English grammar rules in common vernacular here, to the point that some folks (though not my English teachers) think their incorrect use is correct. :) The most marked case I saw was in a Dodo video where the person correctly said "lying", but The Dodo's captions "corrected" it to "laying".

But I digress.


The fun thing about grammar is if enough people do it and think it's correct, it's correct. Languages change.


Linguistics should seek to be descriptive rather than prescriptive. The field should, primarily, seek to describe language as used. Prescriptions can be useful and should be made if they improve a language's ability to provide clarity (please mind the theirs and toos, and sometimes an Oxford comma would clarify your sentence) but they should be held to be mere suggestions and not authoritative mandates.

The idea that there is only one correct way to use a language and that it is determined in academic circles and should be enforced on the masses is inherently based in illegitimate authority and social exclusion and is not a social force for good.


Languages evolve over time. Someone's rules from 200 years ago need not apply, just as they likely didn't apply 200 years prior to that.


I could care less about your explanation!

> When I moved to the US in my teens, I was surprised at the sheer disregard of English grammar rules in common vernacular here, to the point that some folks (though not my English teachers) think their incorrect use is correct.

You noted a common feature of incorrect Americanisms, which is that many of its speakers proudly and ignorantly proclaim their usage is correct. Disregarding descriptive linguistics, all it takes is one second of logic to realize why an incorrect saying doesn't make sense at all, but even that is asking for too much without getting into an argument sometimes.


> I could care less about your explanation!

Maybe you should care less about it then.


bait?

It's *couldn't care less my dude


Maybe reconcile in your mind the first line with the follow-up explanation to see whether it's bait or not and if it should be taken seriously.


Major subsidiaries within a large company can and do have separate CEOs. For example, YouTube also has a separate CEO (previously Susan Wojcicki, and now Neal Mohan) under Sundar Pichai.


It’s also common within Microsoft. I can’t speak to when/why they decide to do it, but the leads for the Microsoft Gaming (Phill Spencer) and LinkedIn [acquired 2016] (Ryan Roslansky) are both CEOs in the org chart at Microsoft.


To make sure I understand correctly: did you want to read a `String` and have lots of references to slices within the same string without having to deal with lifetimes? If so, would another variant of `Rc<str>` which supports substrings that also update the same reference count have worked for you? Looking through crates.io, I see multiple libraries that seem to offer this functionality:

[1]: https://crates.io/crates/arcstr [2]: https://crates.io/crates/imstr


It’s deeper than that.

Let’s pretend I was in C. I would allocate one big flat segment of memory. I’d read the “JSON” text file into this block. Then I’d build an AST of nodes. Each node would be appended into the arena. Object nodes would container a list of pointers to child nodes.

Once I built the AST of nested nodes of varying type I would treat it as constant. I’d use it for a few purposes. And then at some point I would free the chunk of memory in one go.

In C this is trivial. No string copies. No duplicated data. Just a bunch of dirty unsafe pointers. Writing this “safely” is very easy.

In Rust this is… maybe possible. But brutally difficult. I’m pretty good at Rust. I gave up. I don’t recall what exact what wall I hit.

I’m not saying it can’t be done. But I am saying it’s really hard and really gross. It’s radically easier to allocate lots of little Strings and Vecs and Box each nested value. And then free them all one-by-one.


Something like the following? I am trying and failing to reproduce the issue, even with mutable AST nodes.

  use bumpalo::Bump;
  use std::io::Read;
  fn main() {
      let mut arena = Bump::new();
      loop {
          read_and_process_lines(&mut arena);
          arena.reset();
      }
  }
  #[derive(Debug)]
  enum AstNode<'a> {
      Leaf(&'a str),
      Branch {
          line: &'a str,
          meta: usize,
          cons: &'a mut AstNode<'a>
      },
  }
  fn read_and_process_lines(arena: &Bump) {
      let cap = 40;
      let buf: &mut [u8] = arena.alloc_slice_fill_default(cap);
      let l = std::io::stdin().lock().read(buf).expect("reading stdin");
      let content: &str = str::from_utf8(&buf[..l]).unwrap();
      dbg!(content);

      let mut lines = content.lines();
      let mut latest: &mut AstNode<'_> = arena.alloc(AstNode::Leaf(lines.next().unwrap()));
      for line in lines {
          latest = arena.alloc(AstNode::Branch{line, meta:0, cons: latest});
      }
      println!("{latest:?}");
  }


I checked my repo history and never committed because I failed to get it working. I don’t recall my issues.

If you can get a full JSON parser working then maybe I’m just wrong. Arrays, objects with keys/values, etc.

I’d like to think I’m a decent Rust programmer. Maybe I just need to give it another crack and if I fail again turn it into a blog post…


oxc_parser uses bumpalo (IIRC) to compile an AST into arena from a string. I think the String is outside the arena though, but their lifetimes are "mixed together" into a single 'a, so lifetime-wise it's the same horror to manage. But manage they did.


I've just built a parser in Rust that seems to function in exactly the way you say. It reads the text into a single buffer, assembles the AST nodes in an arena (indexes are NonZeroU8's to save space), and all token nodes refer to the original rather duplicating the text. The things I'm parsing are smallish (much less than 64k, 256 tokens), but their is around 100M of them so was worth the effort to build it in a way that used 0 allocations (the arena is re-used).

It was a bit of effort, but it can't be that difficult given it's my first non-toy Rust program and it wasn't that hard to get going. I'd written maybe 50 training exercises in Rust before that, over the years. Yes, the same thing in C would have been faster and easier to write (I've written many 100's of thousands of lines of C over the years), but I'm not sure it would of worked the day after it compiled.

I also had to build a 2nd parser that looked at maybe 100 lines. It was clone() all the way down for that one because I could afford the cost. I think that was easier to write in Rust than C, mostly because of the very good standard library Rust comes with.


To add to it, I crossed the border into the US via train recently, and for the first time (I've done this trip many, many times) they took my photo on their cell phone after scanning my paperwork, as they did with everyone else. So they are further expanding with more/recent data.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: