Readit News logoReadit News
viktree commented on A reasonable configuration language   ruudvanasseldonk.com/2024... · Posted by u/todsacerdoti
gary_0 · 2 years ago
I wonder if anyone would take me seriously if I suggested WASM as a configuration language. When run, the WASM would be given imports that provide a small API for manipulating the config DOM, and importing and executing further WASM files. Then you can use whatever high-level config language you want (or, say, a subset of Rust) and compile it to WASM.

Existing JSON/YAML/etc could be compiled to WASM that simply builds the corresponding DOM.

Funny joke?

viktree · 2 years ago
I think this is what the zellij terminal multiplexer uses for extensions.

It's worth mentioning that in the opposite direction, if you wanted to have an interpreted config option with fewer compile steps, there's also the option to use lua — a language for which the compiler itself is quite small and portable

See,

[1] : https://zellij.dev

viktree commented on I deeply regret my participation in the board's actions   twitter.com/ilyasut/statu... · Posted by u/Palmik
singularity2001 · 2 years ago
what about those who think they know but in truth they don't? "humans"?
viktree · 2 years ago
See

> Some think they do - but don't. (idiots)

viktree commented on Privacy is priceless, but Signal is expensive   signal.org/blog/signal-is... · Posted by u/mikece
pelasaco · 2 years ago
I'm kind of happy to don't see Moxie with such rockstar salary as for instance the CTO one..
viktree · 2 years ago
From the same link, it seems like his compensation was much higher in all the preceding years. Not sure what changed this year, but I agree it's a bit refreshing to see. Especially since he's probably made good money throughout his career
viktree commented on Brave Browser introduces vertical tabs   brave.com/vertical-tabs/... · Posted by u/czottmann
bradgessler · 3 years ago
The more enhancements I see browser vendors making to tabs, the more I think they’re reinventing bookmarks/favorites.

Safari introduced “tab groups” a while back, which to me is an insane mess of complexity. When I think about it though they’re just folders and each tab is a bookmark/favorite.

The vertical tabs in Brave remind me of bookmarks/favorites too.

viktree · 3 years ago
This is one feature I like in the Arc Browser. Persistent tabs are bookmarks, and bookmarks are just as accessible as regular tabs.
viktree commented on Cheating is All You Need   about.sourcegraph.com/blo... · Posted by u/iskyOS
tornato7 · 3 years ago
I have a camp 4: viewing coding as a roadblock. A necessary obstacle to achieving some result. This is how companies view programming. They don't know about it, don't care about it, they just know they have to do a lot of it to produce their next product.
viktree · 3 years ago
Tacking roadblocks as they come up in service, creating a better product … that sounds a lot to me like engineering except with some words twisted around?
viktree commented on Amazon walking back raises after internal bug miscalculated compensation   businessinsider.com/amazo... · Posted by u/JumpCrisscross
f1shy · 3 years ago
Have you worked in any big company afterward (or before) that was not toxic? The reason of my question: I work in a very big company, and I found it very toxic. I wonder if all big companies are the same.

I need to know if I would switch. But I do not want to go to smaller company.

viktree · 3 years ago
I'm curious, what's the big company you are at now?
viktree commented on We're moving to a four-day work week at Beacon   beaconcrm.org/blog/beacon... · Posted by u/500and4
herpderperator · 4 years ago
What is 4-10s?
viktree · 4 years ago
If a typical workweek is (8 hr) * (5 days) = 40hrs, I think gp is referring to (10 hr) * (4 days) = 40hrs
viktree commented on I do not agree with Github's use of copyrighted code as training for Copilot   thelig.ht/abandoning-gith... · Posted by u/janvdberg
oefrha · 4 years ago
Is Copilot trained on source available code? If not, then whatever restrictions you may want to apply with your source available code isn’t relevant. The debate is about copyleft.
viktree · 4 years ago
The RMS function in Quake Source code exists in the copilot training set (see https://news.ycombinator.com/item?id=27710287) is covered under GPL which is source available (see https://github.com/id-Software/Quake-III-Arena/blob/master/c...)
viktree commented on It's probably time to stop recommending Clean Code (2020)   qntm.org/clean?tw=... · Posted by u/avinassh
nojokes · 5 years ago
I am surprised that this is the top answer (Edit: at the moment, was)

How does splitting code into multiple functions suddenly change the order of the code?

I would expect that these functions would be still called in a very specific order.

And sometimes it does not even make sense to keep this order.

But here is a little example (in a made up pseudo code):

  function positiveInt calcMeaningOfLife(positiveInt[] values)
    positiveInt total = 0
    positiveInt max = 0
    for (positiveInti=0; i < values.length; i++) 
      total = total + values[i]
      max = values[i] > max ? values[i] : max
    return total - max
===>

  function positiveInt max(positiveInt[] values)
    positiveInt max = 0
    for (positiveInt i=0; i < values.length; i++) 
      max = values[i] > max ? values[i] : max
    return max

  function positiveInt total(positiveInt[] values)
    positiveInt total = 0
    for (positiveInt i=0; i < values.length; i++) 
      total = total + values[i]
    return total

  function positiveInt calcMeaningOfLife(positiveInt[] values)
    return total(values)-max(values)
Better? No?

viktree · 5 years ago
> How does splitting code into multiple functions suddenly change the order of the code?

Regardless of how smart your compiler is and all the tricks it pulls to execute the codein much the same order, the order in which humans read the pseudo code is changed

  01. function positiveInt max(positiveInt[] values)
  02.   positiveInt max = 0
  03.   for (positiveInt i=0; i < values.length; i++) 
  04.     max = values[i] > max ? values[i] : max
  05.   return max

  07. function positiveInt total(positiveInt[] values)
  08.   positiveInt total = 0
  09.   for (positiveInt i=0; i < values.length; i++) 
  10.     total = total + values[i]
  11.   return total

  12. function positiveInt calcMeaningOfLife(positiveInt[] values)
  13.   return total(values) - max(values)

Your modern compiler will take care of order in which the code is executed, but as humans need to trace the code line-by-line as [13, 12, 01, 02, 03, 04, 05, 07, 08, 09, 10, 11]. By comparison, the inline case can be understood sequentially by reading lines 01 to 07 in order.

  01. function positiveInt calcMeaningOfLife(positiveInt[] values)
  02.   positiveInt total = 0
  03.   positiveInt max = 0
  04.   for (positiveInt i=0; i < values.length; i++) 
  05.     total = total + values[i]
  06.     max = values[i] > max ? values[i] : max
  07.   return total - max
> Better? No?

In most cases, yeah probably your better off with the two helper functions. max() and total() are common enough operations, and they are named well enough that we can easily guess their intent without having to read the function body.

However, depending on the size of the codebase, the complexity of the surrounding functions and the location of the two helper functions it's easy to see that this might not always be the case.

If you want to try and understand the code for the first time, or if you are trying to trace down some complex bug there's a chance having all the code inline would help you.

Further, splitting up a large inline function is more trivial than reassembling many small functions (hope you got your unit tests!).

> And sometimes it does not even make sense to keep this order.

Agreed. But naming and abstractions are not trival problems. Often times it's the larger/more complex codebases, where you see these practices get applied more dogmatically

u/viktree

KarmaCake day4November 18, 2018View Original