HackerLangs
TopNewTrendsCommentsPastAskShowJobs

nmz

no profile record

comments

nmz
·15 ngày trước·discuss
I'd rather it use ?.() the . means getkey, () means expression using .(expr) should be the same as array[], throwing ? as a character should be very obvious what it does.
nmz
·15 ngày trước·discuss
> Const keyword: changing const from `local a <const> = 42` to `const a = 42` is far better syntax. The bracketed syntax was never a good idea.

The bracketed syntax is an okay idea especially for <close>, adding close as a keyword would be a disaster given how common the word is. If anything, local should have been tossed away as a keyword and the bracketed syntax adopted completely

    v <local const close>, v2 = io.open'file', false
    g <global const> = 5

5.5 introduced global which makes better use of attributes as well. of course, I don't deny how great it would be to not type <> or local const since const would already imply a local

> string interpolation

Hisham already made this nice module https://github.com/hishamhm/f-strings Which I don't dare use, even if you don't have string interpolation. Of course, I don't care because I just have a table.format(tbl, "tbl.key is %{key}"), is it a little tedious? sure, but its just a gsub call.

> short form function syntax

I disagree with this, I've always wanted it and roll my eyes as I write/create a function, especially when you like to use lots of them like

    str:gsub('%d+', (s){ tonumber(s)+1 })
> Named varargs: It may be nice, but there is no real reason to add this. If you wanted a name for your varargs you could do `local name = ...` or just use the `args` variable already available in every function.

You've made a mistake there

    local name = ...
is

    local name = ({...})[1]

In order to actually do this you need to

   local name = table.pack(...)
If you will use a vararg, you will always have to do this, so why not just let it be handled in the parameter definition? its costless. AND lua5.5 already introduced this so it seems they liked it.

Quite frankly I would like the capability of treating ... as just an array like ...[1] but I haven't looked at the parser to see if its feasible or not.

> Switch/Match/Select Statements: An optimized if/else block works just as well and another expansion of a small language.

I don't disagree, but big table of functions is so ugly, switch statements would be nice
nmz
·15 ngày trước·discuss
a lone ? can mean anything, you can already tell that . is for fetching a subtable.
nmz
·15 ngày trước·discuss
This is something I don't see a lot of people do. I've tended to do

  for long,list,of,variables,here
  in ageneratorhere(bigparameterhere)
  do
  end
and

  local x do
    -- everything after is just here to define x
  end

I'm still a little irked it works so well, the only alternative would be for the language to have labeled blocks. but that might be too terse
nmz
·15 ngày trước·discuss
No, not basically, it simply doesn't have them, Ternary means three as in it operates on 3 operands, and/or operates on 2 operands. They are also not equivalent.

   x = a ? b : c # x is b, same as you would if a {x=b} else {x=c}
lua and/or

    a,b,c = true, 1, 2
    x = a and b or c -- x is b


    a,b,c = true, false, 2
    x = a and b or c -- x is c
The or is dependent on its previous operand, so b will return false and skips to c, even if you meant for it to be b. you must use an if then else. However, you can have more than a ternary, if there is no need for short-circuit evaluation, as in, any of the operand is not a function CALL like c(), and you want to remain inside an expression, then you can do this instead

select (select is a native C function, this is faster than the table creation below)

    x = select(a and 1 or 2, b, c)
table creation/selection

    x = ({false,2})[a and 1 or 2]

of course, doing something like

   local x; if a then x=b else x=c end
does not look so bad
nmz
·tháng trước·discuss
https://youtu.be/nepKKz-MzFM&t=7195

If you can stand Lex Friedman for a bit, the VLC authors talk about why you use ASM for a video decoder instead of pure C or rust.
nmz
·2 tháng trước·discuss
Via comparison of the solutions, we measure objectives and actions performed and the time it requires to do them.

Objectively, Minecraft is a game, an objective of many games is to waste time, therefore this cannot be used as a measurement, but enjoyment is. as a game it fulfills its role. wastefulness could be classified in comparison to other solutions/clones, like minetest. If minetest fulfills exactly the same goals with less action as minecraft, then minecraft is in comparison wasteful.

Another measurement is mining solutions can we achieve the action of mining with less compute? can we not mine at all? does not mining achieve the same goal? if it does, then mining is objectively wasteful.

The objective of crypto is replacing fiat currency, it does not do this, therefore it is wasteful. Of course, this is only true until it does replace it, which is why we must compare, would this cryptocoin scale to the entire world? does it require more work for it to do so? if so then it is wasteful.
nmz
·2 tháng trước·discuss
Legalities aside, You can use compute how you want, that doesn't stop anybody from accurately measuring its usefulness. Given that this is an objective measurement.

I can have a computer on an endless loop without any idling, consuming as much CPU time as it can, I do not know any other classification of this action than wastefulness. crypto mining is useful of course, the end goal of mining is to get crypto, of course, there is no further goal beyond that.
nmz
·2 tháng trước·discuss
Well, it seems he wasn't, he's not gonna get upvotes though, HN is startup culture and startup culture is selling dreams until it works or you notice too late you got robbed.

And who's gonna admit that bitcoin is a ponzi scheme when all of their savings are in it? you can't, it would devalue your own money, so you're trapped, you can only further invest in it.
nmz
·2 tháng trước·discuss
So many people here know how bitcoin works but don't know that it doesn't.

It is hilarious.
nmz
·2 tháng trước·discuss
It worked on ipv6 only for like a year, it seemed to be back this last month but it seems to be back down right now probably because of this whole github ragequit happening.
nmz
·2 tháng trước·discuss
It has a wiki, forum and issues included. So it definitely can do that, what fossil allows by default is to not have a docs/ or bugs/todo file, because its all in the server part.
nmz
·2 tháng trước·discuss
A key feature of github is you could bug report on many projects without registering an account for each one, this is not true of fossil. if fossil is to be taken seriously, then it needs a distributed auto id system, oauth or the like.
nmz
·2 tháng trước·discuss
I trust more a megacorp to survive more than 5 years than a personal host, I can't tell you how many times I've gone to a personal server where something I used was hosted and its dead.
nmz
·5 tháng trước·discuss
Except its actually useful, unless you pay sdf for membership (it's just like $30 or so) the only commands it can run is stuff on /bin, which is their prerogative, but tilde is much better. oh and they erase your account if you don't log in, which, why would you even login if there's nothing to do
nmz
·5 tháng trước·discuss
To this day, FPC uses less ram than any C compiler, A good thing in today's increasingly ramless world and they've managed this with way less developers working on it than its C compiler equivalent, I can't even imagine what it would look like if they had the same amount of people working on it. C optimization tricks are hacks, the fact godbolt exists is proof that C is not meant to be optimizable at all, it is brute force witchcraft.

At a certain point though, something's gotta give, the compiler can do guesswork, but it should do no more, if you have to add more metadata then so be it it's certainly less tedious than putting pragmas and _____ everywhere, some C code just looks like the writings of an insane person.
nmz
·6 tháng trước·discuss
One of the most used paid and proprietary software is windows, and its users do not matter at all to how it implements its features.
nmz
·6 tháng trước·discuss
I've often dreamed of a system where normal users, give money as a promotion for a certain issue to be fixed or even created, if the user wants feature X then he should be able to give an incentive towards that feature to be added into the software that they use, developers do bounties instead, the user doesn't have to give much only a dollar, but if many users want feature X, then the money/donations pool creating higher incentives until the task itself matches the level of work to be performed to achieve it until merged.

The project managers also get a cut of all merges, testers also must approve of the merge and that feature X is the one they want. So the project manager gets to work and improve/reject features, the user gets control over the features of the project they want and developers get to pick specific features they would like to work on (sort of). everybody gets what they want (sort of). All via attaching $ to the issues of the software, not the people.
nmz
·7 tháng trước·discuss
Is an LLM human now?
nmz
·7 tháng trước·discuss
There's nothing stopping anybody from making a batteries included lua, and plenty have done so (emilua, luapower, luaforwindows, luart and etc), of course, pure lua still exists and their changes are usually backported into lua since its so small and portable.

FWIW you can do a lot with pure lua and unless you're importing json there's no reason to include a library for it given that lua itself can be used as the data exchange format.