Live data from Hacker News

When if is just a function

ryelang.org

91–100 of 111 posts

Re: When if is just a function

#91
There's more to this that I'd absolutely love to see in a language, and I can't tell if rye supports. If you want an ergonomic `if` you need its scope aspects too.

Consider this example

    
    x = ...
    if foo:
       y = ...
    else:
       x = ...
       y = ...
    
Critical parts of the ergonomics are that

a) in each branch, we have everything in scope that comes from

b) in , we have everything in scope that was assigned or reassigned in the executed branch

I'd love a language that supports programmable stuff like if, since I'm tired of python autodiff not handling `if` and `for`. But it would really need programmable scope stuff to still allow the ergonomic "scope effects" that make `if` and `for` blocks ergonomic.

Re: When if is just a function

#92

Just here to point out that the actor’s name is Bob Odenkirk not Odendirk. In a statically typed language this would be an error at compile time not hacker news comment time.

gcc() { curl -d '{"title": "Does this code look right?", "body": "$(cat $1)"' https://$HN_BASE/api/ask }

export gcc

Re: When if is just a function

#93
post #47

Earlier quoted context omitted.

You can rarely successfully generalize about languages in the Lisp family. :) TXR Lisp: (relevant to this article) there is an iff function that takes functional arguments. Square the odd values in 0 to 9: 1> (mapcar [iff oddp square use] 0..10) (0 1 2 9 4 25 6 49 8 81) The use function is a synonym of identity : i.e. just use the incoming value as-is Square the even ones instead by inverting oddp with notf: 2> (mapc…

What's the benefit of being implemented as lisp-2 but acting like lisp-1 with [ ]? Why not just be a lisp-1? > TXR is an original notation for matching entire text documents or streams, inspired by the unification that underlies logic programming systems This has me hooked.

while there are certain simplicities and economies in a Lisp-1, it's a bad idea on the whole, and has irksome disadvantages.

Lisp-2 also has irksome disadvantages, like the verbosity in code working with functional arguments.

I want to give myself and my users the advantages of Lisp-1 and Lisp-2, as well as ways to avoid their respective disadvantages, so there is no way to get around having some kind of combination that lets us work in different styles.

Re: When if is just a function

#94
post #86
post #84

Earlier quoted context omitted.

This is on FF for me. Specifically Zen, which is FF based.

You still have this problem? I tested and fixed css yesterday. What exactly is problematic?

I hadn't checked since I posted this, but today the entire document appears properly unredacted! Nice work.

Re: When if is just a function

#95
post #76

The Trade-offs section doesn't list the biggest one. Secretly, all code wants to be spaghetti. You and your team have to put a conscious effort into prevent that from happening. Degrading the core of the language like this is like inoculating your homebrew with sewage and expecting it not to go wrong.

That is sort of like saying all visual art projects want to become "the million dollar / pixel homepage" so providing an empty canvas and full color palete will just enable people to create visual sewage because nothing stops them from doing so. I never programmed in a team, so my experience of programming is probably very different from yours. You probably want something like electric cattle fencing (if I borrow you…

By all means, go full avant-garde. I have nothing against experimental stuff like this. The "throw it at the wall an see what sticks" idea.

According to my own experience, it's entirely possible to write a rancid spaghetti carbonara all by yourself. I'm not saying you shouldn't do it (it's a heck of a learning experience) or it should be banned or prevented or anything. But if the language comes with a tin of e. coli, at least list the side effects.

Re: When if is just a function

#97
Using closures or code blocks when they're unnecessary gets in the way of static analysis and (sometimes) readability. It's often better to avoid using language constructs that are more powerful than needed for the job. You can still use them when doing something more advanced.

Re: When if is just a function

#99

The Trade-offs section doesn't list the biggest one. Secretly, all code wants to be spaghetti. You and your team have to put a conscious effort into prevent that from happening. Degrading the core of the language like this is like inoculating your homebrew with sewage and expecting it not to go wrong.

> degrading the core

> experimental

These ideas have been tried and tested for 60 years now and result in less spaghetti.

Re: When if is just a function

#100
post #76

Earlier quoted context omitted.

That is sort of like saying all visual art projects want to become "the million dollar / pixel homepage" so providing an empty canvas and full color palete will just enable people to create visual sewage because nothing stops them from doing so. I never programmed in a team, so my experience of programming is probably very different from yours. You probably want something like electric cattle fencing (if I borrow you…

By all means, go full avant-garde. I have nothing against experimental stuff like this. The "throw it at the wall an see what sticks" idea. According to my own experience, it's entirely possible to write a rancid spaghetti carbonara all by yourself. I'm not saying you shouldn't do it (it's a heck of a learning experience) or it should be banned or prevented or anything. But if the language comes with a tin of e. coli…

What exactly would be the e. coli here?

I mean this is not the first dynamic, homoiconic, reflective language. Which one of these os something I didn't list is the obvious negative or e. coli as you call it?

Post reply on HN