Recent Forum Posts
From categories:
page 1123...next »
Evgenii (guest) 02 Sep 2019 10:26
in discussion Hidden / Per page discussions » Anti-social Punishment

Hi all!

I want to add to a previous comment with a joke about farmers and cows.

There is a joking saying in Ukraine and Russia, that happiness is not when you bought a cow, but when your neigbour`s cow died. : )

by Evgenii (guest), 02 Sep 2019 10:26
Dorkus Malorkus (guest) 13 Aug 2019 02:32
in discussion Hidden / Per page discussions » Linguistics and Programming Languages

In Python (3.7), " if not foo == 'A' or 'X' " will return True no matter what the value of foo is (if any).

This is because the condition (foo == 'A'), as well as ('X') respectively, are evaluated separately (and in turn).

All it takes for an OR clause to pass in Python is a single True somewhere along the road during short-circuit evaluation (see the wikipedia article on 'short-circuit evaluation').

by Dorkus Malorkus (guest), 13 Aug 2019 02:32
Yuriy (guest) 11 Aug 2019 14:22
in discussion Hidden / Per page discussions » Hard Things in Computer Science: Naming things

This is a good example of context-specific semantics. You only understand what it is because it's so common within the context of OOP. If it weren't for GoF and the popularization of "Design Patterns" due to them, you would have pretty much no idea of what a "Factory" is. So we need a common framework in which we think about the things, and consequently name these things. OOP design patterns is an example of such a framework. Obviously such an approach has vast advantages but can be quite limiting, especially when not thought out carefully.

by Yuriy (guest), 11 Aug 2019 14:22
Yuriy (guest) 11 Aug 2019 14:16
in discussion Hidden / Per page discussions » Hard Things in Computer Science: Naming things

I guess the lesson to learn is to reify everything, inducing semantics. Semantic annotations depend very much on the context and have a very vague meaning, as opposed to type annotations, which have a very clear and well-defined meaning (based on the semantics of the programming language at hand). Similarly to how the type is declared explicitly in the variable declaration instead of just being a prefix of the variable name, the semantics should also be made concrete and explicit. This would, however, require adoption of some formalization of semantics, which 1) requires a common semantic framework and a consensus among those using it, and 2) such formalization is difficult for most people to grasp and become comfortable with using, I'm afraid.

by Yuriy (guest), 11 Aug 2019 14:16
Yuriy (guest) 11 Aug 2019 13:59
in discussion Hidden / Per page discussions » Hard Things in Computer Science: Naming things

This applies to anything else really. If you are a perfectionist, everything seems to suck because nothing is perfect. It's better to adopt the "better than nothing" mindset, and try to think how to make things better. Now you at least know what is the "ideal" way to do things, so you know which way to go. You are no longer in the dark. I would say, it's easy to claim "everything sucks" and not do anything to improve it, but once you start actually putting effort into it, you realize it's not easy and you start to appreciate, or at least understand, the "state of art" which is often not ideal.

by Yuriy (guest), 11 Aug 2019 13:59
Yanis Batura (guest) 07 Aug 2019 12:07
in discussion Hidden / Per page discussions » Two Approaches to Structured Concurrency

In your Trio code example, the worker function is called worker, but passed to nursery.start_soon as myfunc. Is this a typo or I'm missing something?

by Yanis Batura (guest), 07 Aug 2019 12:07
John (guest) 02 Aug 2019 09:26
in discussion Hidden / Per page discussions » Enforced Error Handling

That language exists today! Zig does exactly this: https://ziglang.org/#A-fresh-take-on-error-handling, check it out :)

by John (guest), 02 Aug 2019 09:26
Penguin Monkey (guest) 30 Jul 2019 18:58
in discussion Hidden / Per page discussions » Where are Python macros?

You can run the static analysis tools after all the macros have expanded, or before. If you do it before the macros are just function calls. The macros are what allow you to make custom static analysis tools…

by Penguin Monkey (guest), 30 Jul 2019 18:58
Penguin Monkey (guest) 30 Jul 2019 18:49
in discussion Hidden / Per page discussions » Where are Python macros?

Well you still have stuff like Threads, mutable state, MetaClasses, eval, exec… currentframe().f_back.f_locals, etc… Macros are awesome, especially if you disallow "binding" forms (introducing variables). They let you check code at runtime. For example, you can write a macro version of open that can check whether or not files exist at *COMPILE* time not *RUN TIME*. Other types of static analysis are possible. Caching is very important for run-time efficiency, and making a custom static compiler could also be possible.

by Penguin Monkey (guest), 30 Jul 2019 18:49
limaCAT (guest) 23 Jul 2019 06:32
in discussion Hidden / Per page discussions » In the Defense of Spaghetti Code

Without thinking about design patterns you cannot really Refactor your code into something manageable either. With a 1500 lines function you need to test it with the expected output data and expected input. When vendor two is introduced you will need to add a test that expects the new stepping rule. You cannot test it on the lab equipment because it is already too late. Without tests and some architecture it's like driving cross country without a map or traffic signs, you might arrive at your destination but you might also end up into a ditch.

by limaCAT (guest), 23 Jul 2019 06:32
lsem (guest) 03 Jul 2019 13:58
in discussion Hidden / Per page discussions » On Rigorous Error Handling

I used to work on a project where all functions that can fail return bool indicating success or failures. In addition to that, each unit (not a class or function, but unit, leaving in separate file and responsible for doing some meaningful work) declared a list of error identifiers together with error messages. In unit implementation unit can set not single error but entire stack. Whenever one feels he or she can handle error (function returned false), you can get error from stack, otherwise if you want, push error to the top of the stack and do `return false`.

I like that approach and that was a serious, carefully written succesfull realtime system for automation control industry.

by lsem (guest), 03 Jul 2019 13:58
lsem (guest) 02 Jul 2019 20:54
in discussion Hidden / Per page discussions » Type-safeness in Shell

I come up with similar idea about web services reflection. Why tool like poster (or even like curl) cannot ask web service its interface like example.com/api and get schema both machine and human readable. Then build UI so that I interact with ease without "400 bad request"?

One important thing would be to ensure it does not lie. May be schema should be used as source for generation of API stubs and test suite (just dry run without invoking actual handler, ensuring it does not return 400/404).

by lsem (guest), 02 Jul 2019 20:54
Matthew (guest) 27 Jun 2019 17:52
in discussion Hidden / Per page discussions » Programmatic Code Generation: Composability

With ribosome you can put a block of code in a function with no parameters, which is pretty similar, you have that in your "Colors" example.

"The takeaway from that was that code generation is fun to write but hassle to read"

I don't disagree, that's why I feel like you need to be able to keep the code and the models in the same place. Effictively I just want really hardcore and powerful metaprogramming that's easy to write, I guess, which is what I was trying out with cgen. I still haven't used it to build anything big though, though I'd like to someday :) Was a hobby project. Using it at the time seemed extremely powerful but I haven't come back to it.

by Matthew (guest), 27 Jun 2019 17:52
Dan (guest) 23 Jun 2019 08:27
in discussion Hidden / Per page discussions » Getting rid of state machines (II)

Hi I think you should delete the <-chanA inside !isHeader

by Dan (guest), 23 Jun 2019 08:27

I wholeheartedly agree with the sentiment of the article, but admit that the topic of exceptions is a tricky one, especially when it comes to the low level application stack.

C++ is a powerful mess. It lacks elegance and fails the "less is more" principle. The success of Java in complex systems and as a business language should be, to a great extent, attributed to the failure of C++.

C++ is neither a proper high level language nor a system programming language. It's stuck in the middle. Despite its undeniable ugliness, it added a lot of value and allowed the authors of C#, Java, Kotlin to learn from its mistakes.

It was a wonderful idea to move away from C++ and write nanomsg in C. It's just a lot cleaner this way. ZeroMQ should have been written in C in the first instance.

by Vlad (guest), 14 Jun 2019 12:04
Hannes (guest) 09 Jun 2019 16:49
in discussion Hidden / Per page discussions » Type-safeness in Shell

Might be worth glancing at TypeScript's type definitions. By using .d files written in a a definition language, type safety can be added on top of JavaScript. Good ones are taken up into a repository of officially supported typings. With a similar approach, type information could, at least to some degree, be added to command line tools.

by Hannes (guest), 09 Jun 2019 16:49
Thomas Gebert (guest) 30 May 2019 19:49
in discussion Hidden / Per page discussions » Type-safeness in Shell

You know, I never really thought about it, but I do wonder if someone could encode a dependent-type-system into a shell. Languages like Idris have a REPL, indicating that they *can* run in interpreted mode, so conceivably you could have some kind of typesafe pipe that handles it.

Awhile I took a stab at making a Lisp-based command line shell, which was going to play nicely with JSON and Protobufs by default, but my computer crashed, I got a new computer, and forgot that I had started that project until right now. I should start that again.

by Thomas Gebert (guest), 30 May 2019 19:49
bsbsbs (guest) 23 May 2019 20:39
in discussion Hidden / Per page discussions » Type-safeness in Shell

It's a tempting idea. Funnyways, strings are often enough. When you ps and grep PID it is an integer but who cares ? Would you need to handle it as an integer ? Only in cases you care about certain property of ints e.g. comparison.
What I personally miss in bash are more decent datastructures — there are arrays and assoc arrays — but nothing beyond. I'd guess decent parsing of numbers in shell with actual error handling would be enough for me, also some assert e.g. 'this must be number' — I would not need full type system and type checking in shell.

As for IPC, I'd hate json as protocol, because I hate json. I'd even be in favor of binary protocol, but IMHO anything with a fix structure it a trap. Text is retardedly simple to parse/extract, anything with sctructure becomes pain over time

by bsbsbs (guest), 23 May 2019 20:39
apostolis (guest) 21 May 2019 11:18
in discussion Hidden / Per page discussions » Type-safeness in Shell

What is the difference between a shell command and a function in a program?
The shell command has a text ui and a function does not. If we were to automate the creation of a ui for functions, then functions could take the role of commands. And an ui does not have to be text based.

by apostolis (guest), 21 May 2019 11:18
b15r (guest) 16 May 2019 06:30
in discussion Hidden / Per page discussions » The Politics of Age (the Young vs. the Old)

I am a bit torn on this.

While the general aging of the population is a very interesting way to think about it, I do think that a lot of young people are not for action on climate change because they have come to the conclusion that it is an important issue, but because that is what is socially acceptable and "in fashion" (ignoring, for arguments sake, whether it is the right thing to worry about or not).

What I am saying is that while age can definitely lead to conservatism and stagnant opinions (possibly a consequence of loss aversion, c.f. Status Quo Bias), it can also lead to a more nuanced understanding of issues and more independent thinking, simply because the person has a greater set of experiences and knowledge to draw from than when they were younger and think on larger timescales. The precise fact that something will not affect me ten years down the line might also lead to less selfish thinking, maybe?

Then again I don't know if that is just my perception fooling me, it might be that the distribution between well-reasoned and logically thought out political opinions vs. going with whatever is the currently socially acceptable position is roughly the same across age groups. I wonder if there's been any analysis into this.

by b15r (guest), 16 May 2019 06:30
page 1123...next »
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License