top | item 8610970

The Duck Programming Language

93 points| xigency | 11 years ago |ducklang.org

22 comments

order
[+] femngi|11 years ago|reply
I have to ask what this language is trying to provide that isn't already provided by lua or python when it already looks almost identical to them. Has it got an end goal that I cannot see or is it just being done out of an interest in programming languages?
[+] Udo|11 years ago|reply
> or is it just being done out of an interest in programming languages

That would be enough. I believe more people should be thinking about programming languages - even if it's just for fun or learning.

> what this language is trying to provide that isn't already provided by [...]

Most languages don't provide things that aren't technically also provided by others. It's more about how they are provided, what the language's strengths are, and how it wants programmers to approach problems.

Showing people what your language is all about is harder than it seems at first. Duck could probably do with a more in-depth tutorial and some talking points in order to better inform people about its features.

This made me look at the website of my own perpetually unfinished language project, and even though I knew I had to make an effort to showcase the thing in the tutorial section, upon reviewing it now I don't think it was particularly successful. Arguably, there are even some high profile languages that don't do a good enough job explaining what they're about, though website quality has picked up dramatically across the board in recent years.

[+] xigency|11 years ago|reply
These are good questions.

The end goal is much farther along than what's being presented now. This has, for the most part, been a one person effort. I was motivated by my Compilers course and a minimal Java compiler we developed targeting MIPS to start a project creating my own language.

Much of my experience with programming languages has been with interpreted or scripted languages. I find that they have a really low barrier to entry. But ideally Duck would have its own binary compiler and other tools. It's just that right now, in the language forming stage, it makes sense to formalize all aspects of the programming language first. In the future, it might be the case that Duck has significantly better performance than Lua or Python, but I can't really tell at the moment, especially without some tweaks to the language that move it towards static/strongly typed code. This is just the nature of reality.

So yes, it's mainly a toy language at this stage, but I would like to see it optimally used as a game language. I think it may be extremely easy to have it facing several different platforms, and use it as a high-level abstraction for loading 3D meshes and manipulating an interactive world.

[+] fractalsea|11 years ago|reply
I have no idea. Probably an interesting project for the author, or maybe they are trying to fix some backwards-compatibility debt from the aforementioned languages. Either way, it would be good to see this mentioned as the first point on the page because it will be the first thing everyone will be thinking.
[+] fspeech|11 years ago|reply
From the front page:

"It is easy to port libraries to Duck. Function hooks are implemented as pointers, of the form int (function_pointer)(int) where the argument count is passed as the only parameter. Arguments are bound as string identifiers, and are accessed dynamically in the bound-function's body."

I don't know the details but in my experience reducing the impedance mismatch to low level libraries is often a strong motivator to create one's own dsl instead of adopting a standard scripting language.

[+] xigency|11 years ago|reply
Best answer: It's free to use and super easy to customize
[+] xigency|11 years ago|reply
For those of you wondering about the motivations of this, I'd like to explain that it's mostly an enthusiast project but it might have some utility down the road.

Honestly, I don't see anyone else using this language besides me. I just enjoy implementing projects from the ground-up, so this was a chance to really do that. Originally, this was going to be part of a project to design a minimal computer from the CPU down to the operating system, but I don't really have time for that.

I'm hoping some day that Duck will find its uses, somewhere.

[+] xigency|11 years ago|reply
An example of the fixed-point combinator in Duck:

  function fixed_point(f)
    function curry(g, i)
      function recurse(j)
        return g(g, j)
      end
      return f(recurse, i)
    end

    function apply(k)
      return curry(curry, k)
    end

    return apply
  end
[+] fdsary|11 years ago|reply
This looks like a nice language, mad props to the author(s) for actually creating a new language, that's something I dream of doing one day!

But I wonder, is this means for me to use, and then why should I use it? The text had great examples of how to use it, but I couldn't find the why.

Again, super cool that you wrote a language!

[+] xigency|11 years ago|reply
Thanks. It's meant for anyone to use. The language is basically in Play-Doh form at this point, so it's something you can do whatever you want with.

Obviously, depending on what you want to do, it might take more effort on your part, but I think that's a large part of the point in programming.

For me, the motivation is mainly researching garbage collection/memory management and function closures.

[+] klibertp|11 years ago|reply
Take a look at http://createyourproglang.com/ - it's very good for making language creation seem less magical. Well worth the price. It's not a replacement for a "proper" discussion of PLT and compiler design and such, but it's nice as the first step.
[+] k__|11 years ago|reply
Funny.

The curly braces of the other language in the examples look in place to me. But seeing all the ends and loops I feel it would be cleaner if they had been left away and the dev had opted for indentation based blocks.

[+] TazeTSchnitzel|11 years ago|reply
Only barely related, but it'd be nice if more languages had something similar to BASIC at the end of a loop (NEXT <VAR>). That way, if you're looking at the tail end of several nested IFs and loops, it's easier to know where you are.
[+] xigency|11 years ago|reply
I'd really encourage you to checkout the git repo and modify the syntax yourself. It's almost like play-doh.
[+] tete|11 years ago|reply
Looks like a nice little language. I wonder what the intention was for not using or (re)implementing Lua.

I might be wrong, but it seems kinda close to it on first look.