• @addie@feddit.uk
    link
    fedilink
    83 days ago

    No love for the ‘declarative’ programming paradigm? You can actually do some useful work with SQL or Ansible…

    • @barsoap@lemm.ee
      link
      fedilink
      33 days ago

      Functional is also declarative because control flow is implicit/unspecified.

      What’s actually missing is logic programming, of which the likes of SQL are a subset.

      • @frezik@midwest.social
        link
        fedilink
        53 days ago

        There are scripting extensions to SQL that definitely are. There are some features in some SQL servers that make it Turing Complete even without scripting stuff.

        https://stackoverflow.com/questions/900055/is-sql-or-even-tsql-turing-complete

        Like HTML5+CSS3 being Turning Complete, it’s easy to add features that accidentally make you hit the threshold. Many would argue that it’s a sign complexity has run away from you, and I tend to agree.

      • @addie@feddit.uk
        link
        fedilink
        33 days ago

        Frezik has a good answer for SQL.

        In theory, Ansible should be used for creating ‘playbooks’ listing the packages and configuration files which are present on a server or collection of servers, and then ‘playing the playbook’ arranges it so that those servers exist and are configured as you specified. You shouldn’t really care how that is achieved; it is declarative.

        However, in practice it has input, output, loops, conditional branching, and the ability to execute subtasks recursively. (In fact, it can quite difficult to stop people from using those features, since ‘declarative’ doesn’t necessarily come easily to everyone, and it makes for very messy config.) I think those are all the features required for Turing equivalence?

        Being able to deploy a whole fleet of servers in a very straightfoward way comes as close to the ‘infinite memory’ requirement as any programming language can get, although you do need basically infinite money to do that on a cloud service.

      • @barsoap@lemm.ee
        link
        fedilink
        23 days ago

        Pure SQL, as in relational algebra, is LOGSPACE/PTIME. Datalog is PTIME-complete when the program (“query”) is fixed, EXPTIME-hard otherwise.

        It’s all quite tractable, but there’s definitely turing-complete declerative langugages. Not just pretty much every functional language, but also the likes of prolog.