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

Await is nice, but even with promises, I'd settle with people using them correcly: return something in the promise to the next one can use it without nesting.

But people use promises... and keep nesting.


Even back in early Node days we figured this out with ideas/libs like async.waterfall, which let you turn nesting into a serial flow:

    async.waterfall([function(callback) { callback(null, 'one', 'two'); },
                     function(arg1, arg2, callback) { callback(null, 'three'); },
                     function(arg1, callback) { callback(null, 'done'); }]);
Thus you don't need to make things like 'one' and 'two' into scoped variables that require nesting the second function into the first one so it can see them, and you can split those functions out of being inline lambdas.

Or early Promise libs like coolaj86's futures which included a sequence, letting you do the same sort of thing:

    var seq  = Futures.sequence();
    
    seq
    .then(function(next) { setupContextObj(next, obj)})
    .then(retrieveMD)
    ...
    .then(postUrlDataToS3)
    ...
while also being able to make nice little future() objects you could return from functions and pass around. To be fair it's still JS and lots of third party code needed regular old callbacks so it was still easy to get excessive levels of nesting of various things that leave you with function-closing sequences like });}});return future;} or });}}).end(buf);} that could make a Lisper blush.

These days it's quite a bit nicer having native Promises, a better community-wide understanding of how to use them, but also the syntactic sugar of async/await improves over the waterfall/sequence/.then&.catch chaining styles (especially when it comes to modifications where you want to use data from previous stages of the chain in later stages).


The ResultAsync class in neverthrow has chaining as well as splitting on ok/error - I find this really nice because you can also do away with exceptions at the same time.

I feel like fp-ts is even more powerful for this - provided you (and your entire team / every new hire) can navigate the steep learning curve which tbh defeated me when I tried to learn it in a couple of days last week


I'd argue (from memory!) that there are solid edge cases for nesting promises .. probably all scope-related, where multiple async operations are required for a result that would otherwise require scope-leak / pollution.


I spent a year in a meditation center, and the results vary a lot from person to person, because what somebody needs right now in life is different from everybody else.

Some people will need to become more discreet, while some people need to take more space, some people need to be less materialistic, while others need to accept to use material for their own comfort, some people need to play more, some need to work more.

Also, what you see is rarely the definitive result: it's usually only part of the ungoing correction, meaning you may be seeing a swing on the other side of the curve, a different kind of unbalance, and it would be easy to judge the meditant is not progressing.

However, progress in meditation is not an absolute, it is always to be understood in the context of each human. Some start from very far away on their path, and what your perceive as failure may be a great success for them.

As usual with things that are practiced inside yourself, there is no objective way of measuring progress. We don't have a wisdom metter. This is also why it's very hard to assess if somebody is practicing correctly, or if some teaching is off. Teachers have tools for this, but even that is fuzzy at best.

My personnal experience is that I used to be minimalist, and after years of meditation, now I buy more things. I used to attend to more social events, and now I'm declining regularly some of them. Now some around me could see that as a regression. But from my perspective, it's a way of taking more care of myself.

Be careful with the way you evaluate people, practicing or not. You are probably not having all the context.


Did you get enlightened? I'm thinking of spending a few months on retreat soon. I've always wanted to have an awakening.


Ah, ah :D

I don't even know if enlightening exist, to be honest.

For me, it doesn't matter. I don't need the promise of something potentially amazing in the future, I'm just interested in something that makes my life better right now.

In the center, I only met regular people with ordinary problems, even teachers. Getting a hang on suffering, one step at a time. Sometimes being completly off the mark, because humans are humans.

Meditation is also probably the most boring thing I ever encountered. It's unspectacular, tedious, slow and utterly mundane.

But it's the only thing that I've tried that brings consistent, increasing benefits in life.

I wish for everybody to find something that is as good for them, awakening or not.


I've spent a few years meditating most mornings and evenings and I'd hoped for more. No fireworks no bliss... feels like I'm not making much progress. But I've read about enough people experiencing much more I wonder where I'm going wrong


All the teachers I practiced with repeated to me: don't look for something special. Don't look for bliss. If bliss comes, don't pay attention to it. Bliss is not the aim of this meditation.

I don't know what meditation you are practicing, and there are so many of them I wouldn't be able to give any advice that would work with your own practice.

So I can't know if you are doing something wrong.

What I know, however, is that in the Vipassana meditation following Sayagyi U Ba Khin tradition, one would advice to focus on practice. There is no expectation. Nothing to achieve.

In this tradition, your role is to provide efforts, but one is not responsible for the result. Things are just rising and passing away. Suffering. Bliss. Anything else. Just appearing and disapearing.

Meditation is just the tool to help us live through that.

Peace is not bliss. Peace means you don't need bliss, nor are you hindered by suffering. Easier said than done, and that's why it's a long path.

It's a lifetime practice. You start again every day. One day, you realize you feel a bit more peaceful and happy than you used to. You smile. And you sit once again.


Have you read MCTB? I feel I'm still in stage 1, maybe 2, but definitely haven't reached the arising and passing away... Still, I find labelling useful. Going to try to find a Mahasi retreat


I haven't. Good luck, I hope you'll find something useful for you.


I'm on the third stage of enlightenment, if you have any questions about my day to day experience.


Is it worth it? Does it live up to the hype of bringing incredible peace and happiness?


It is like living in a video game with the FOV slider turned to max. It has made me very good at "deep work" and I have a much easier time managing day to day stress and emotions. However, it brought out immense periods of suffering (dark night) followed by immense peace in cycles. The biggest inconvenience to me is the sleep disruptions, which is why I'm taking a break from deeper insight practice, and just try to maintain it, the same way a power lifter might just go to the gym for health reasons without trying to set a new PR.

If you have any interest in accessing a higher state of consciousness (or more accurately a flatter state of consciousness), it's an interesting hobby to pursue, kinda like being good at mental math.


Thanks, I'd always wondered whether it'd affect my day job


What is the sound of one hand clapping?


Clearly not Soto then. Which tradition? :)


Originally Theravada Thai Forest tradition, under Ajahn Dune's lineage, but now I'm more aligned with this https://www.mctb.org/mctb2/table-of-contents/part-v-awakenin...


As a python veteran, I'm quite envious of the advanced destructuring you get in some languages.

Unpacking doesn't let you specify default values if cardinality doesn't match, nor can you extract dictionaries by keys.

Since operators.itemgetter and itertools.slice are limited, I end up either adding a dependency or reinventing the wheel for every project.


> Unpacking doesn't let you specify default values if cardinality doesn't match, nor can you extract dictionaries by keys.

I'm a bit confused by this one, but maybe I'm misunderstanding. Does this not accomplish what you're defining?

  def parse_record(first=0, second=1, **all_the_others) -> dict:
      return dict(first=first, second=second, **all_the_others)

  dictionary = dict(first=99, third=2)
  parse_record(**dictionary)

  > {"first": 99, "second": 1, "third": 2}


That's packing. Unpacking would be something like this:

    d = {'a' : 10, 'b' : 20, 'c' : 30}
    {'a' : v1, 'b' : v2, **others} = d
    print(v1, v2, others) # prints 10, 20, {'c' : 30}


Exactly.

The working code in Python, as a function, would be:

    def extract(mapping, *args, **kwargs):
        for a in args:
            yield mapping[a]
        for key, default in kwargs.items():
            yield mapping.get(key, default)


there is a pattern matching in Python 3.10 (match/case) which can match dictionaries. https://peps.python.org/pep-0636/#going-to-the-cloud-mapping...


Yes, but since it's an expression it is very verbose for a simple assignment.

Python really needs something like:

    {foo: "default", mapping} = mapping


You might want:

    foo = mapping.pop("foo", "default")
It removes "foo" key from mapping if any. `foo` is "default" if "foo" is missing and `mapping["foo"]` otherwise.

Dictionary unpacking compatible with the match/case syntax could look like:

   {"foo": foo, **rest} = mapping 
It asserts that there is "foo" key in mapping and puts its value into `foo`.


This is what i liked most working a bit in JS. How you can deconstruct, even in the function definition!!! Using {}. Why did they have to use that for sets in python ahhh.

Also using ? For attributes that might be there and being able to chain that is sooo awesome.

These two things make for example working with nested Json in JS so much better than in Python.


The ? attribute would indeed be a welcome addition, but not to work in the same way as in JS. In JS, it ignore null values. That wouldn't work in python.

We would need a ? to says "ignore AttributeError, IndexError and KeyError on that access".

However, the use of {} for set is not a problem.

First, remember than Python is much, much older than JS. Insight is 20/20. Second, you could always use a different syntax.


> Unpacking doesn't let you specify default values if cardinality doesn't match

Functional languages that have pattern matching have wildcard matches that allow you to explicitly handle things that don't match as expected and also have tail matching for lists.

> nor can you extract dictionaries by keys

I'm not exactly sure what you mean here, but you can definitely do that for records in F# and maps/structs in Elixir. It's done all the time.


I think the parent comment is referring to how you can do e.g., `let {x, y, z} = point` (JS, object/dictionary) or `let Point {x, y, z} = point} (Rust, struct) but in Python your only option is `x = point.x; y = point["y"]` etc


Indeed.

Now you can do:

    import operator
    foo, bar, baz = operator.itemgetter('foo', 'bar', 'baz')(mapping)
But it's verbose, inelegant, and doesn't handle missing values.


I misread their first sentence. I see now that they’re lamenting what I mentioned not being in Python. I was thinking they meant in general and not just in Python.


Also:

- add time constraints, where you need to implement widgets that you could source from a JS framework ecosystem otherwise.

- in your 10 engineers, make it 5 juniors, 2 interns and 3 seniors comming from PHP, and make sure they write all the code in the same style, follow a congruent architecture, can find solutions to common problem, get easy onboarding, etc.

- request sub-routing, off-line mode, notifications, content udpated by multiple users and so on.

- put a big table in there with 10000 rows and ask your team it renders fast.


Identification systems on computers are already abused to extremes. There is no way a putting a identifiction system inside your body is not going to result in tremendous abuses on the long run, with much more terrible social consequences since it will be linked to individuals and hard to disable or remove.

The simple fact there no guaranty of safety that can be made about such a system despite its obvious consequences about tracking, power and control should alone be a red flag.

When I read such a comment, I can't help but think school should make kids read more science fiction. Many authors covered why something like this is a dangerous idea.

I'd go even farther, but I would reach the Goodwin point.


5bpm is earth shattering for longevity and general health.


Still better than what happens in the US.


QT talent pool and ecosystem is a rounding error compared to what we have with the web ecosystem. If you want to make something with medias, graphs, a few custom widgets, a reactive layout and deep routing, it will take 10 to 30 times longer with QT.

I myself prefer the snapiness of QT apps, but budget and time to market will win.


Electron apps are always resource hogs, frequently slow and generally integrate extremely poorly. As a consumer I care not one whit for how large the "talent pool" for the web ecosystem is, I care about how terrible the application is.

As a developer I must say calling it talent is in most cases a huge stretch, as I do believe you can probably make something in Electron that performs passably, integrates passably and will still be a resource hog. The reason we see basically none of this is because people simply don't care to engineer these applications well. "It's just the browser", after all. Why look deeper?


Sure but most teams do the maths for the cost/benefit ratio and make the call.

In this context the argument is moot: a better app that is too expensive or slow to make is simply not going to be released vs the worse one that actually gets published.

That's all there is to it.

That's why people still use wordpress, excel or jupyter notebooks for important stuff.

You may want things to be different, and for good reasons, but it's still what's the market has decided.


What does "deep routing" mean?


Views, sub views, partial views and complex hierachic workflows. Url base routers are great for those, but QT controllers let you reinvent the wheel.


I assume either deep nesting or deeplinks.


    ...
    I'm adding A1 and the 7C
    Everybody's looking to SUM() things


Well yes, the Goodwin point is now crossed very casually, just like people are using superlatives for the mundane things, such as "I ate the most amazing fries yesterday".

This makes for poor debates, where there is little nuance, fuzzy scales and hardly meaningful communication.


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

Search: