Is Python still a decent programming language?

Attached: 2019-05-09-1557423589_202x151_.png (202x151, 50.23K)

Other urls found in this thread:

kristoff.it/blog/zig-colorblind-async-await/
ziglearn.org/
twitter.com/NSFWRedditImage

>Python for Everybody-Full Course with Dr. Sneed

In conjunction with others, yes

No. But a lot of languages aren't.

I'm fucking sick of encoding, compiling with my brain, logic into if conditionals, for and while loops.

I don't fucking care about muh structuralism
If, for, while, that's exacty the same as writing fucking automatons.

Automatas are very natural imo to encode a lot of problem. The problem is not the semantics, the problem is that the fucking syntax used to implement automata doesn't fucking scale.

Beyond 3 or 4 level of nested control flow structures and you don't understand anything.
The most anying thing is that you don't see the overall picture of the control flow.

And a lot of the time, you endup repeating the same conditionals over and over.

I'd argue that the solution is to have imperative langauges that actually do a decent job of implementing their model of computation. In Functional languages, you clearly have all the power of lambda calculus Whereas I don't feel I have the power of all automata theory in any Algol-like language.

Control flow is exactly the same thing as DFA/NFA. We need multiple equivalent syntaxes for them (one imperative-like if,for, while, one regex-like, one functional like : mutual recursion, and maybe others adapted to encode the DFA as a graph, maybe an edge list )

On top of that we need object with an actual semantic.
That would be, an object = an automaton, or composition of automatons. (dfa/nfa, register machine, stack machine, random access machine, queues, ..)

Imperative programs should be conceived as a composition of automatons. Automatons have state and the compute.

Composing automatons would be the silver bullets against nesed control flow. They should be run sequentially, but would have concurrent states.

So the idea would be running some DFA 1, and at a certain node (where there is a callback), it could "call" / jump to another one that could do its thing, transition to any number of states, and go back / return to DFA 1, EXCEPT that it state would be preserved after jumping back.

So that's why they are descrbed has having a concurrent state, but are run sequentially.

python is basically the new cobol

>oldest one in this class at 82. Just finished 3 months of VBA for Excel. Dr. Chuck seems to be teaching in a way I can understand.
it's never to late g!!!

Attached: 1621011506340.jpg (640x640, 31.96K)

>Is Python still a decent programming language?
Python was never a decent language when compared to more modern languages like Zig

>concurrency
Built in event loop style N:M threading, just like Go. Just add one line of code and you're able to run millions of coroutines with ease. Solving the C10k (and C10M) problem was never easier.

pub const io_mode = .evented;

kristoff.it/blog/zig-colorblind-async-await/

>performance
It's a compiled language with a backend that uses LLVM, so it has all of the optimizations that Clang will ever give you in C/C++. No slow or unpredictable GC, so you can be sure there won't be any GC lag spikes. No more worrying about the 95% percentile response times!

Scared of memory management? Just use the 'defer' keyword user, EZ RAII style cleanup. Want to be be even lazier? Have a single arena allocator scoped per HTTP request and forget about memory management entirely!

>Is Python still a decent programming language?
It is not. Embrace the future old man, and head on over to ziglearn.org/ to get started! Need help? IRC is #zig on libera.chat.

pub fn helloWorld(req: Request, res: Response) !void {
try res.print("Hello {}!", req.queryParam("name") orelse "World");
}

>I'm fucking sick of encoding, compiling with my brain, logic into if conditionals, for and while loops.
the notion of order for example

And in complement of all this, which would be a huge step up over "structured" imperative languages, there should be in conjunction a way to do logic, like in Prolog.

The combination automatas + logic would finally be a match for functional programming/

Functional programming is currently more powerful that imperative language. Not because lambda calculus is more powerful than automatas, but because imperative languages make an absolutely shit job at being an embodiment of what automatas can be and should be.

Algol was never meant to be imperative's finest. We lost our way to end up with a OOP as a cope.

We learn about automatas only in the context of regexes and parsing. People vomit what the have learned on students.

We should see automata as a more general thing that can compure anything.
For one, as for booleans, numbers, strings, lists, dictionaries, struct, nested data strucures and pointers/references,
the state of a DFA is a type of information, which is distinct of all the rest. That's one configuration among a finite set of different configurations.

The state of an allocator or garbage collector is best represented as a particular state of a finite state machine.

The state of a program is better represented, not as an instruction pointer (which is a random access machine concept), but as the state of a C-like machine (stack + registers + ram + DFA (inside which block are we on ?))

Also, FP people keep bitching about immutability being the best thing for concurrency.
It is not. Concurrent automatas are a better mental model. They can wait in a given state, and exchange messages with a buffer or a queue.
They can even transfer the control flow from one to the other with a "stateful" goto.

Concurrency means existing independently. The best way to think about this is imagining several objects having their own configuration in parallel.

Things that automatas are good for :
- representing the control flow blocks of any program
- regex, parsing
- GUIs
- communication protocol
- implementing a buffer
- implementing an allocator (when do we have to malloc ?), and a garbage collector
- system programming: formalising a modification of the state of the file system
- an iterator, a thing walking over a data structures and making changes in place or storing, creating data along the way. That means anything with graphs
- something making a transformation on a stream
- something that compute expressions
- something that multiplyy matrixes
- and on and on, any computation can be expressed this way

It was always shit, but 3 is even worse than 2 ever was.
From GIL to (((whitespace))) to the ridiculously broken relative imports and thus entire module system (resp. extremely primitive in 2), to how slow it is to the lack of checks for things that are trivially verified and which are checked and warned/errored in any other scripting language, it's always been a disaster, only good to cobble together a few other tools using it as glue.

you just made my day

no, but It's a very good scripting language

You need PDAs to do anything useful.
Here's your homework though:
Design a language's syntax for efficiently describing PDAs. Efficiently is with regard to the syntax: it must not contain superfluous or non-orthogonal elements, except helpers. It must contain as few forms as needed, except to reduce redundancy (for example, it is OK to have 'numbers' as part of the language, no need to only accept '1' and 'inc').
If you cannot retain reasonable readability and concision, and/or if you cannot retain desirable properties in the result, such as easy modification, reasoning on logic, and refactoring, it is a failure.

Fuck the clusterfuck of python imports

Yes, when I say DFA, I'm implicitly means that there can be anything, any code in the nodes/states. I know what the term means, but I like to see it as more. As a control flow graph.

I've been thinking about a langauge for a while. Orthogonality is important for sure.
In the end, I want a language that is imperative, functional and logic (+ concurrent) and have these 3 paradigms integrate seamlessly.
I also want it to be good a code generation.

I have the instinct there is somehting to be done. But I need to know logic in a profound way first.
I kind of have the idea that a good way to integrate imperative and functional would be to convert each of them to logic predicates, which would serve as a common language and intermediate representation.
And then, logic predicates should have to be converted back to imperative. Because in the end assembly and computers works like that.

Conveting languages to logic would have the benefit that it would be very appropriate to prove things, as you do when doing code optimizations and transformations. Or type checking.

And it would also have the advantage of defining a new language on top, with very clear semantics, and being able to use the already build backend to manipulate the logical IR.

Classical compilers and interpreters transform the code intto an AST, and then to some IR which is either imperative based, or functional based like in haskell. I think logic would be a powerful alternative.

But logic should be available in the high level language, not only in the intermals. I think this has a huge untapped potential in code reuse.

For example, in Prolog, there are a lot of computations that we can define to work 2 ways. That's in contrast with procedures and functions that can only transform input into output, but not vice versa. If you want the inverse function, you have to write it. Which is stupid because most or all of the logic is already described in the first function.

In Prolog, you can write the factorial which works both ways.
Find factorial of N. And you can use the exact same relation to find N such that factorial of N is 120 for example.

You can also define a relation for searching in a graph, all nodes that have their descendents matching x property. And you can use the exact same relation to find the reverse, nodes that have parents that match a y property.

If we could combine this with polymorphism, we would have an even bigger benefit.

One way to do this would be taking the syntax f Forh
Or adding push and pop to a subset of C
Or using recursive functions
Or adding push and pop to regexes
Or defining some syntax to encode various way of representing graphs, and again maybe add push/pop
they are probably other ways

even using prolog's predicates and rules to implement a PDA, although this is more a semantic encoding, like with recursive functions

or yet again, augmenting this clever syntax for representing NFA (and more if you consider the semantics of the nodes)
$ perl -E 'use re Debug => "DUMP_PRE_OPTIMIZE"; "ababc" =~ / (a|b) b+ c /x'
Program before optimization:
1: OPEN1 (3)
3: BRANCH (6)
4: EXACT (9)
6: BRANCH (FAIL)
7: EXACT (9)
9: CLOSE1 (11)
11: PLUS (14)
12: EXACT (0)
14: EXACT (16)
16: END (0)

the number on parentheses at the end of each is a goto to the next node

It has a debugger now, which is nice. The switch statement is fucking stupid if. Just look at PowerShell's switch case statement, much better.

it never was.