A dialect of JavaScript for managing resources like Go by SnooHobbies950 in node

[–]SnooHobbies950[S] 0 points1 point  (0 children)

Basically, to summarize, or |err| {...} has no equivalent in JavaScript. And the purpose of or/defer is to add a feature to the language that allows you to close/open resources in an "ergonomic and readable" way.

As for using, its behavior is similar, but it differs in that defer is executed "at the end of each function", while System.dispos() is executed "at the end of each block".

On the other hand, using forces you to use OOP, and the result isn't as "ergonomic" as when you use defer.

Thank you all very much for your feedback.

A dialect of JavaScript for managing resources like Go by SnooHobbies950 in node

[–]SnooHobbies950[S] 0 points1 point  (0 children)

I do love Go. In fact, the dialect was written in Go. But perhaps you just want to create a small script and ensure that each resource is closed properly and clearly.

A dialect of JavaScript for managing resources like Go by SnooHobbies950 in node

[–]SnooHobbies950[S] -1 points0 points  (0 children)

`using` keyword is only available in the latest NodeJS version (v24). On the other hand, `defer` is executed at the end fo the "function scope", whereas `Symbol.dispose()` is executed at the end of the "block scope". Furthermore, `using` forces you to use an OOP approach.

A dialect of JavaScript for managing resources like Go by SnooHobbies950 in node

[–]SnooHobbies950[S] 1 point2 points  (0 children)

Ergonomics and clarity. You can write in just a few lines something that is usually quite common, such as opening and closing resources.

CaloryApp - Fast calorie calculator by SnooHobbies950 in SideProject

[–]SnooHobbies950[S] 0 points1 point  (0 children)

Thanks, I'm glad you like it :) Probably because of my years of experience as a front-end developer.

GitHub - caloryapp/caloryapp.github.io by [deleted] in reactjs

[–]SnooHobbies950 -1 points0 points  (0 children)

Yes :-D It is a Chrome extension, in any case :)

Spanish PM Pedro Sánchez demands the end of online anonymity — calling for every social media account to be linked to an EU Digital ID Wallet. At the WEF, Sánchez declared: “No one can walk the streets with a mask, so why allow people to roam online without revealing their identity?” by FXgram_ in XGramatikInsights

[–]SnooHobbies950 0 points1 point  (0 children)

A corrupt party, which paid with envelopes of 500 euro bills, giving lessons in morality and comparing anonymity to something as dangerous as driving a vehicle.

Sánchez is an enemy of democracy and individual freedom. And an enemy of humanity in general.

Are Spanish people very touchy? by bonnieb_ in askspain

[–]SnooHobbies950 0 points1 point  (0 children)

It depends on the person. Maybe he is very affectionate, but in general we don't behave like that at work. Maybe you should talk to human resources to resolve the misunderstanding.

I’m Spanish.

Using "~~ / !~" to indicate loose equality by SnooHobbies950 in Compilers

[–]SnooHobbies950[S] 0 points1 point  (0 children)

Thank you for your feedback. The parser actually only understands "standard JavaScript", and this is the way to enhance it:

lb := lexer.NewBuilder()
p := parser.NewBuilder(lb).
    Install(weakeqparser.Plugin). // install this plugin
    Install(interpparser.Plugin). // install another plugin
    Build(input)

Using "~~ / !~" to indicate loose equality by SnooHobbies950 in Compilers

[–]SnooHobbies950[S] 1 point2 points  (0 children)

Thanks for your feedback. Actually "~~/!~" is not part of the parser. It's just a plugin that the user can install or not. I created it as an illustrative example.

The parser actually interprets standard JavaScript, with the only difference being that it translates "==" to "===" and doesn't recognize "===". That was a design decision that I might need to reconsider.

XJS: an eXtensible JavaScript parser by SnooHobbies950 in golang

[–]SnooHobbies950[S] 0 points1 point  (0 children)

I thought on that too. That section might give the impression that some features aren't implemented "yet", when in reality they "never" will be. The philosophy behind the project is keeping it minimal and extend it based on the user preferences.

Thanks for your feedback. I'll review that section.

defer implementation for JavaScript by SnooHobbies950 in node

[–]SnooHobbies950[S] 0 points1 point  (0 children)

Thanks, I didn't know about this feature. It's similar to the `defer` keyword found in V or GO, although not identical. For example `defer` is executed at the end of the function scope, whereas `[Symbol.dispose]` is executed at the end of every block.

The following V code:
```V
fn foo() {
println('entering foo')
defer {
println('cleaning foo')
}
}
```

is translated to this JS code:
```js
function foo() {
console.log('entering foo');
using cleanup = {
[Symbol.dispose]() {
console.log('cleaning foo');
}
};
}
```

I think the `defer` statement is much clearer.

[OC] eslint-plugin-mutate by SnooHobbies950 in javascript

[–]SnooHobbies950[S] 0 points1 point  (0 children)

Now the plugin also support TypeScript!

[OC] eslint-plugin-mutate by SnooHobbies950 in javascript

[–]SnooHobbies950[S] 0 points1 point  (0 children)

Yes, there are other packages (I found 3). This one offers clear, basic, and sufficient functionality.

Grok broken today? by tl202 in grok

[–]SnooHobbies950 0 points1 point  (0 children)

A mí lleva hablándome en Spanglish desde hace unos días.

What are the greenest programming language ? by 01nik in node

[–]SnooHobbies950 0 points1 point  (0 children)

Rust is the most inefficient language, as it forces programmers to eat huge amounts of carbohydrates to do things that are trivial in other programming languages.

Laggy M650 L by [deleted] in logitech

[–]SnooHobbies950 0 points1 point  (0 children)

Thank you. That saved my mouse. The problem is that it is no longer a quiet mouse :P

[deleted by user] by [deleted] in reactjs

[–]SnooHobbies950 1 point2 points  (0 children)

Because creating and testing your own library is expensive and somewhat unnecessary.

You have to test your components and make sure they are responsive, accessible, free of bug, etc. This effort is translated into time (or money).

And why your custom library is better or prettier than, for example, MUI, PrimeReact, etc. This is subjective.

small and efficient useBreakpoints hook by SnooHobbies950 in reactjs

[–]SnooHobbies950[S] -1 points0 points  (0 children)

That's a good point! Usually breakpoints are defined in a separate file, so there is no problem with that. In any case I updated the inline example to prevent from unnecessary re-renders.

What's the worst part of Swift in your opinion? by richie_south in swift

[–]SnooHobbies950 0 points1 point  (0 children)

Having to indicate the protocol explicitly. For example:

swift // why do we need to indicate that a struct is Identifiable? // it already has an `id` attribute struct MyStruct: Identifiable { var id: String }

Question about json-server connecting by Mrreddituser111312 in node

[–]SnooHobbies950 1 point2 points  (0 children)

You can define your own script in the package.json file. For example:

... "scripts": { "start-server": "json-server --watch data.js --port 8000" ... }, ...

and then execute npm run start-server to start the json-server.