Live data from Hacker News

The unreasonable effectiveness of declarative programming

bollu.github.io

51–60 of 128 posts

Re: The unreasonable effectiveness of declarative programming

#51
post #50

Back in the day when I was making videogames ( http://www.mysterystudio.com ), I implemented something similar for my framework. Most of the framework was declarative. There were Sprite objects that had an associated Image and a position (among other things). The onUpdate(dt) method of the "screen" didn't explicitly draw things on the screen, it only updated positions and other attributes of the Sprites, and the rend…

I've got to ask, for stuff like "Murder, She Wrote", did you license anything? If so was that hard and what was the process like?

For MSW, CSI:NY, Sherlock, and others, we were working with a company in LA called Legacy Interactive. Technically, these are "their" games, we did exclusively all the programming and scripting. They got the licenses for the TV properties, commissioned the art, and wrote the storylines. So unfortunately I can't comment on the licensing process, as I wasn't involved :(

Re: The unreasonable effectiveness of declarative programming

#52
For me, there are only two benefits to declarative programming: Safety and quick Understandability of code. I would say that markup languages fall into this category (HTML, Markdown etc.)

Everything else is better to be done by some sort of imperative language. The declarative stuff can be a subset and a convention but you can always break out of it.

Re: The unreasonable effectiveness of declarative programming

#53

Earlier quoted context omitted.

IMHO in a declarative language your example should be an error. You defined x twice. Intentionally or not, this is confusing, for others and for you in a week when you have to look at the code again. Also, why should the second binding override the first? You introduced a temporal dimension where later lines of code somehow override earlier lines of code. That is not a necessity in a declarative language. It may be h…

>> IMHO in a declarative language your example should be an error. You defined x twice. This would be an error in a language with immutable data structures. Declarative and immutable are not the same thing and there is nothing that says a declarative language must have immutable data structures.

I think the idea is that declarative statements use "equals" like math uses equals, not as assignment. If you say x = 1 and then later say x = 2, that is a contradiction. Usually if you evaluate each statement in order from top to bottom, that is procedural programming. And if you don't do that, it's hard to assign multiple values to one variable because you need a way for the compiler to know when the variable has each value.

Re: The unreasonable effectiveness of declarative programming

#55
post #19

Earlier quoted context omitted.

My friends and I love playing "Murder, She Wrote" on a big TV screen during downtime at LAN parties. We streamed it on Twitch for a while. We're big fans, great work!

OMG, seriously? You made my day Try the two Sherlock games if you can get them somewhere - these have a special place in my heart :)

Do you know where to get your games still? My wife would like them... The reason you are not just putting them on archive.org is because of the contracts you had I guess?

Edit: read your other comment and saw the licensing stuff... Shame about games (and such) that you just cannot keep them for sale forever... But just let them die.

Re: The unreasonable effectiveness of declarative programming

#56
post #33

Earlier quoted context omitted.

C has first-class functions support, but I don't think it's very easy to define such interfaces in C. Closures and automatic memory management seem to be the "magic dust" that makes this nice to use, first-class functions are necessary but not sufficient.

C doesn't have first-class functions, because you can't define new functions in general places (only at top level).

The definition of first-class functions is the ability to treat functions as data, which C supports. Yes, they are cumbersome to work with, since they must always be defined at top level, but that is just missing syntax sugar. GCC even allows nested function definitions.

Re: The unreasonable effectiveness of declarative programming

#57
post #33

Earlier quoted context omitted.

C has first-class functions support, but I don't think it's very easy to define such interfaces in C. Closures and automatic memory management seem to be the "magic dust" that makes this nice to use, first-class functions are necessary but not sufficient.

C doesn't have first-class functions, because you can't define new functions in general places (only at top level).

[deleted]

Re: The unreasonable effectiveness of declarative programming

#58
Qt with QML does exactly this with animations. It works very well. You don’t really need a functional language to do this kind of thing. I’ve written classes in C++ which are composed to produce different behaviors. Composition in OO is a way to accomplish this without using a functional language.

Re: The unreasonable effectiveness of declarative programming

#59
Declarative is great, and I wish more people created clean declarative API with regular languages instead of writting yet another DSL.

But remember that the problem with a declarative syntax, is that it needs a runtime, which typically the end user doesn't touch. And if the runtime doesn't take into consideration one use case, the user is stuck. Don't forget to provide an escape hatch.

Post reply on HN