jump to navigation

The Ideal Language February 29, 2016

Posted by PythonGuy in Uncategorized.
add a comment

I’ve been having conversations with random people from the internet over email. I’ve noticed that it seems we can all pretty much agree on what an ideal programming language would look like, if we can just get past our biases and pre-conceived notions and premature optimizations.

Let me list some of the things that I think the ideal language might have:

  1. Basic and common operations on all the most common data structures. This would include numbers (integers (big and small), floats, maybe rationals), strings (sequences of bytes or unicode code points), arrays / lists, hashmaps / dicts, sets.
  2. Functions as a first-class citizen. Speaking of which, maybe classifying functions as “pure” vs. “impure”, where “pure” functions make no change to program state.
  3. Variables that can store anything.
  4. Perhaps a type system where new types can be defined, but probably not OOP as we know it today. The type system would be mostly invisible.
  5. A module system, where someone else’s code can be loaded into your code, probably with versioning, even allowing multiple versions to run in the same program to avoid dependency hell.

Some things the language most definitely won’t have, or may have but strongly discourage:

  1. Threads. I can rant on why threads used to be cool but why you never, ever want to use them, but I won’t.
  2. Concurrency. If there is concurrency, it should be hidden from the programmer, or the programmer should not be involved in the decision to use it. For instance, the programmer writes a program, and the compiler or whatever can figure out how it can be optimized to run on multiple cores or multiple machines. If the programmer is writing at a sufficiently high-level, then he should be declaring intent rather than process, which allows the computer to figure out the process and leaves people far smarter than the programmer to figure out how to do things faster.

I think it’s important to note that a programming language is an application that allows humans to express their thoughts in a way the computer can translate to code. We should be very conscious of the user (human beings) as well as the limitations of what can and cannot be done on a computer. We should try to structure the programming language to mirror what goes on in someone’s head when they program.

I’ll try to follow up with future articles on each of my points above, but I’d like to hear your opinion on the matter. What features would your ideal programming language have?

Advertisements

Is it possible? (Random Thought) February 6, 2016

Posted by PythonGuy in Uncategorized.
add a comment

Watching https://youtu.be/DJtef410XaM, I am inspired to once again poke around at functional programming.

In particular, I am curious if it is possible to write in such a way that no globals are shared implicitly between functions.

Just a thought: pass global vars along with dynamic vars as explicit parameters into function calls.

AngularJS does something like this, out of necessity, by labeling which dependencies it needs in its declaration.

Also: Writing a module in Python is really writing a function. Importing a module runs that function. The function creates an object (the module) that is populated with data attributes.