Readit News logoReadit News
compsciphd commented on Go Proposal: Secret Mode   antonz.org/accepted/runti... · Posted by u/enz
voodooEntity · 9 hours ago
Thats even better than what i had in mind but agree also a good way to just scrumble stuff unusable ++
compsciphd · 7 hours ago
I'm now wondering with a bit of unsafe, reflection and generics magic one could make it work with any struct as well (use reflection to instantiate a generic type and use unsafe to just overwrite the bytes)
compsciphd commented on Go Proposal: Secret Mode   antonz.org/accepted/runti... · Posted by u/enz
willahmad · 10 hours ago
without language level support, it makes code look like a mess.

Imagine, 3 level nesting calls where each calls another 3 methods, we are talking about 28 functions each with couple of variables, of course you can still clean them up, but imagine how clean code will look if you don't have to.

Just like garbage collection, you can free up memory yourself, but someone forgot something and we have either memory leak or security issues.

compsciphd · 10 hours ago
I could imagine code that did something like this for primatives

  secretStash := NewSecretStash()
  pString := secretStash.NewString()
  ....
  ....
  secretStash.Thrash()
yes, you now have to deal in pointers, but that's not too ugly, and everything is stored in secretStash so can iterate over all the types it supports and thrash them to make them unusable, even without the gc running.

compsciphd commented on Booting Linux in QEMU and Writing PID 1 in Go to Illustrate Kernel as Program   serversfor.dev/linux-insi... · Posted by u/birdculture
piperswe · 2 days ago
Only if you compiled your kernel with literally every module. If you compile your kernel with only the modules your system needs, there’s no such issue
compsciphd · 2 days ago
which then made it difficult to upgrade your hardware.
compsciphd commented on Go's escape analysis and why my function return worked   bonniesimon.in/blog/go-es... · Posted by u/bonniesimon
simiones · 3 days ago
The confusion begins the moment you think Go variables get allocated on the stack, in the C sense. They don't, semantically. Stack allocation is an optimization that the Go compiler can sometimes do for you, with no semantics associated with it.

The following Go code also works perfectly well, where it would obviously be UB in C:

  func foo() *int {
    i := 7
    return &i
  }

  func main() {
    x := foo()
    fmt.Printf("The int was: %d", *x) //guaranteed to print 7
  }

compsciphd · 3 days ago
ok, I'd agree with you in that example a go programmer would expect it to work fine, but a C programmer would not, but that's not the example the writer gave. I stand by my statement that the example the writer gave, C programmer would expect to work just fine.
compsciphd commented on Go's escape analysis and why my function return worked   bonniesimon.in/blog/go-es... · Posted by u/bonniesimon
tdfirth · 3 days ago
I don’t think this is confusing to the vast majority of people writing Go.

In my experience, the average programmer isn’t even aware of the stack vs heap distinction these days. If you learned to write code in something like Python then coming at Go from “above” this will just work the way you expect.

If you come at Go from “below” then yeah it’s a bit weird.

compsciphd · 3 days ago
I don't see how this is coming at go "from below".

even in C, the concept of returning a pointer to a stack allocated variable is explicitly considered undefined behavior (not illegal, explicitly undefined by the standard, and yes that means unsafe to use). It be one thing if the the standard disallowed it.

but that's only because the memory location pointed to by the pointer will be unknown (even perhaps immediately). the returning of the variable's value itself worked fine. In fact, one can return a stack allocated struct just fine.

TLDR: I don't see what the difference between returning a stack allocated struct in C and a stack allocated slice in Go is to a C programmer. (my guess is that the C programmer thinks that a stack allocated slice in Go is a pointer to a slice, when it isn't, it's a "struct" that wraps a pointer)

compsciphd commented on Kenyan court declares law banning seed sharing unconstitutional   apnews.com/article/kenya-... · Posted by u/thunderbong
Retric · 8 days ago
That’s a comment born from ignorance. Farmers want hybrids for a wide range of crops because the are wildly more productive than heirloom varieties thus making them more money.

The first generation of Hybrid seeds are on average several times more productive than the second generation, yet they look the same. Further it’s much easier to gather a second generation of seeds than the first. Thus significantly worse product that’s cheaper to produce but looks identical barring genetic testing = counterfeit.

compsciphd · 7 days ago
people haven't explained why this is the case, it's the simple genetics we learn in biology.

the first generation has a many sets of genes with "Highly Productive Dominant (HPD, my terms for this post) genes, Not so Productive Recessive Gene (NPR)". By inbreeding 2 lines for a while, one can end up with a strain that has both genes being one and thereby when you cross it with something else, you know the offspring will get its gene (as it really only has one). Therefore the first generation, will have many sets as what I described above and will 100% express the HPD of those pairs.

The 2nd generation though of seeds will have a randomized assortment of HPD/HPD, HPD/NPR, NPR/NPR genes. Therefore while 75% of the seeds expressed genes will be HPD on average, that's obviously less than 100% that one gets from first generation.

compsciphd commented on Green card interviews end in handcuffs for spouses of U.S. citizens   nytimes.com/2025/11/26/us... · Posted by u/nxobject
donkeybeer · 16 days ago
Doesn't matter, it's just speech. If you want to say free speech doesn't apply to certain classes of persons then this should be made very loud and clear so these persons can avoid coming to the USA.
compsciphd · 10 days ago
It has been said loud and clear.

the supreme court in Harisiades v. Shaughnessy (1952) said communist party affiliation (even past membership) was reason to deport non citizens.

This is well known in legal circles. This isn't something hidden. A US Citizen can be a member of the communist party (same first amendment, right of assembly), while a non citizen doesn't have the same right.

One can argue that this decision was wrong. One can argue that it is immoral, but its well known, and any immigration lawyer should know this decision, and know the risks their clients are taking on by some actions of theirs.

compsciphd commented on Atlas Shrugged (2024)   david-jasso.com/2024/04/1... · Posted by u/mnky9800n
GMoromisato · 13 days ago
I'm sympathetic to the thesis, but I wish there were more details. For example, what could HP have done differently? Buying Compaq seems like "trying to win" to me--it was trying to expand its PC market share. Was that the wrong acquisition? What would have been better instead?

Fundamentally, however, we know that the markets HP was in were not growth markets: PCs, printers, enterprise consulting, etc. The growth markets at the time were phones (Apple), software (Microsoft), and cloud services (Amazon, Google, etc.) Could HP have succeeded in any of those businesses?

compsciphd · 13 days ago
they bought palm. people were pretty happy with webos/hp touchpad. so there was at least some desire to within hp to go into that market.

instead they cut bait quickly. sold off WebOS to LG and that was it.

compsciphd commented on Dilution vs. Risk taking: Capital gains taxes and entrepreneurs   nber.org/papers/w34512... · Posted by u/hhs
Workaccount2 · 14 days ago
You still need to pay off that loan eventually though.

These asset backed loans are just regular loans with lower interest rates. So instead of getting $50M @ 11% they can get it at 4%. That's the extent of the "hack".

They then keep the ball rolling by refinancing at each expiry and just paying the interest (and hoping their assets maintain or increase in value)

Eventually those loans will need to be repaid and the money will need to come from realizing capital gains.

So if anything its a tax deferral scheme with a low interest rate and elevated liquidation risk. Which all raises the issue of being taxed twice on the same money. Taxes once when you take the loan against it, and taxed again when you realize the profit to pay the loan.

compsciphd · 14 days ago
not really.

I have assets that have a single cost basis of $1

they are now worth $100.

I take a loan secured against 10% of them. I have now taken a tax event against 10% of them.

I now pay taxes on a capital gain of $90 on 10% of them.

I now have an asset split into 2 parts. one with a cost basis of $1 (90% of my assets) and one with a cost basis of $100 (as I paid taxes on a capital gain to $100).

One can perhaps argue that when levaraging unrealized assets for loans, one always uses the lowest cost basis assets for determining taxable event, or perhaps first in first out of taxable events (and therefore paying tax, is an out then an in).

compsciphd commented on WinApps: Run Windows apps as if they were a part of the native Linux OS   github.com/winapps-org/wi... · Posted by u/klaussilveira
jonp888 · 15 days ago
This system works by launching an official Windows image in Docker and then making an RDP connection to it. There are a couple of others too now like WinBoat

What all of them avoid mentioning is that the images were intended by Microsoft for test and development purposes on Windows and the license clearly states you need a valid Windows license to use them: https://hub.docker.com/r/microsoft/windows#license

I wonder if Microsoft will take some action to enforce this if these projects become popular.

Edit: This comment is incorrect, see below comment from doctorpangloss

compsciphd · 14 days ago
Is this a new thing? That windows docker images can run a UI? It's been a while since I looked at them (we're talking 2017-2018?), but back then, one was limited to CLI/Server apps without any windows graphical interface.

I'm wondering when it changed? (or perhaps I missed something back then)

u/compsciphd

KarmaCake day2150February 15, 2012View Original