News for hackers. Stuff that matters.
Re:Pope tempted by Python. Signs off on coding scheme for kids by pryelluw on Saturday October 28, 2023 @06:20PM (#38053934)

    import behavior
    from afterlife import Heaven, Hell, Limbo

    try:
        behavior.good()
        return Heaven()
    except behavior.MoralsError as sin:
        return Hell(sin)
    else:
        return Limbo()
Re:Pope tempted by Python. Signs off on coding scheme for kids by arthurcolle on Saturday October 28, 2023 @06:33PM (#38054020)
bugfix: implement repentance
Re:Pope tempted by Python. Signs off on coding scheme for kids by darigo on Saturday October 28, 2023 @07:14PM (#38054365)
With the traffic between this world and the afterlife, using exceptions like this is really inefficient. Furthermore, a lot of souls with net bad behavior might be in a state of Grace, rescuing them from Hell.

An improvement might look like this:

    def judgement(soul):
        in_grace = soul.state.is_graceful() 
        good_works = len(soul.works)
        if in_grace: return 1 # Heaven
        if good_works > MORAL_MINIMUM: return 0 # Limbo
        return -1 # Welp.
        
Although, given the moral ambiguity of the spec, it might be better to use a language with more undefined behavior like C. Terry Davis addressed a lot of this when he built the third Temple in HolyC.

I actually work parttime at a startup where we're trying to use web3 to establish permanent, digital identities that you can use in the afterlife to bargain with demons. The idea is, you can use an NFT (who says web3 is dead!) to correlate the atoms in the immortal eternal one-soul with their constituent souls on earth, so you can identify your friends in Heaven (or Hell). Eventually, we hope to even link people on earth to people on heaven, via our Rust-based AngelLink blockchain. A sort of "tower to the heavens" so to speak.

If anyone else on HN is interested in this space, feel free to email me (darigo.maxwell at gmail dot com). Always looking to make new friends who love God and have a passion for big data and the thirst for God's presence.

Re:Pope tempted by Python. Signs off on coding scheme for kids by Yoric on Sunday October 29, 2023 @11:24AM (#38059424)
That is a great pitch!

(also, yes, of course you'll need UB for Purgatory, etc.)

Re:Pope tempted by Python. Signs off on coding scheme for kids by 3PS on Saturday October 28, 2023 @07:15PM (#38054372)
I know I'm taking a joke comment WAY too seriously, but... that "else" branch is unreachable, right?
Re:Pope tempted by Python. Signs off on coding scheme for kids by Shish2k on Saturday October 28, 2023 @07:26PM (#38054448)
Correct (in a `try ... else` the else branch is executed when the try block reaches the end of the block with no exception, and the return is leaving the block without reaching the end)

(Bonus context for anyone surprised that it is valid code — Python actually allows you to use “else” in more places than you’d expect - `for ... else` is my favourite (do a for loop over a list of things, `break` if you find the thing that you’re looking for, and then the `else` branch will be taken if you don’t find what you’re looking for. Much cleaner than keeping track of a separate i_found_the_thing bool IMO))

Re:Pope tempted by Python. Signs off on coding scheme for kids by froh on Saturday October 28, 2023 @07:25PM (#38054441)
that's right, and absolutely make sense, as the church meanwhile realized unbaptized babies don't go to limbo but to heaven.
Re:Pope tempted by Python. Signs off on coding scheme for kids by warble on Saturday October 28, 2023 @07:23PM (#38054420)
Depends on the exception. Maybe the sun wasn't moral.
Re:Pope tempted by Python. Signs off on coding scheme for kids by graemep on Sunday October 29, 2023 @03:52AM (#38056607)
Taking the joke a bit too seriously, but that is a statement of moralistic therapeutic deism, not Christianity.

Corrected code.

  from behaviour import repentance
  from afterlife import Heaven, Hell, Limbo

  if person.is_baptised:
     if (person.state == repentance):
        return Heaven
     else:
       return Hell  # FIXME define Hell
  else:
    # TODO I think we need something with Limbo here
    return None
Re:Pope tempted by Python. Signs off on coding scheme for kids by Yoric on Sunday October 29, 2023 @11:22AM (#38059403)
Well, if that code was written at any point after the 12th century, you need to add Purgatory. Also, for Limbo, you need to never have heard of the Catholic Church, so you probably need some kind of information tainting.