Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prague/ Q&A

Name: Anonymous 2013-11-19 12:18

Ask /prog/ anything.

Although don't expect an answer or even a good one.

Also, keep it /prog/ related.

Name: /prog/ mamma 2013-12-21 0:36

>>119,120
If you two don't stop yer fighten and come in and eat yur dina I'm gonna wring both yo necks!

Name: Anonymous 2013-12-21 12:04

>>119
Here. I'll say it with bullet points.

- Python's syntax varies between explicit and concise to a confusing degree, despite claims by Python that the syntax is clean/beautiful/etc.
- Python brings very little new to the table over other languages, and so advertises its syntax as a key point of the language
- Therefore, criticisms of Python's choice of syntax are valid as criticisms of the language.
- Since syntax is one of the first elements encountered by someone who examines Python, and since Python doesn't really bring anything new to the table as a language, it is perfectly reasonable to arrive at the conclusion that ``Python really isn't a very good language'', as this trivial complaint outweighs the even more trivial benefits.

It is not true to say that our only complaints against the language are about its syntax, but frankly, I don't care. You want me to talk about design choices like Guido's (thankfully canceled) desire to remove lambdas because he doesn't like the way they make code look? Tough. I don't feel like it. My point has already been made.

To put it another way, apply your argument to criticisms of PHP, Java, C, Haskell, Brainfuck, you name it. ``[I]f your only complaints against a language are about poor error handling/SingletonFactories/segfaults/burritos/verbosity, you have absolutely no business criticizing it or engaging in discussion about its design.''

If you ask me why PHP is bad, I'll say ``It has poor error handling.''. That's it. The language offers nothing to me that is not outweighed by poor error handling. Maybe if I'm feeling generous, I'll post a link to the Fractal of Bad Design blog. It is possible that I'm a moron, that PHP is the best language in the universe, and that poor error handling is irrelevant compared to other amazing things PHP can do. That is a calculated risk I've taken in deciding that my time is better spent by ignoring PHP than by trying to better understand its design in the hopes of learning something wonderful.

If you look at >>95 , the question was ``Why do you hate Python?''. I don't use Python because of the shitty syntax and FIOC. I don't use PHP because of the poor error handling. There - the question is answered. If you feel like carefully analyzing deeper flaws in Python, then do so. Maybe we'll link to your blog the next time somebody asks that question.

Finally, I'm sick of your unedited posts. Go read a manual of style until you can contribute meaningfully, as I won't be wasting any more time on them.

Name: Anonymous 2013-12-21 14:40

>>122

again, your argument is that colons at the end of ifs and whiles is too explicit and could be removed (despite it, you know, increasing readability, that being one of python's actual goals)

if python didn't bring anything new, why do you think it's been so widely adopted by software devs, system administrators, and the scientific community? (i'll give you a hint - it did)

finally, my argument extended only to syntax. complaining about error handling is a valid criticism because hiding a failure or stuck state from programmers directly affects the quality of code. complaining about factories is a valid criticism (although not a correct one) because you are specifically lamenting the language designer's decision not to have overloaded constructors. on the other hand, syntax is the most trivial aspect of any programming language, and has no direct effect on code quality or performance (inb4 arguments that it leads to decreased productivity, lol)

finally finally, if you can't read sentences that aren't capitalized suck my dick and get off the internet

Name: Anonymous 2013-12-21 17:50

btw i forgot to mention how retarded you are for whining about fioc

oh no! forced indentation of code! what do you mean everyone already writes code like that because it is the most legible way to write in a statically scoped block structured language? MY FREEDOMS

tip: you're free to write python like this - "while True: foo(); bar();"

Name: Anonymous 2013-12-21 21:01

>>123,124
You talk like you have a bunch of dicks in your mouth.

why do you think it's been so widely adopted by software devs, system administrators, and the scientific community?

AHAHA, you're just retarded as them to think it brought anything ``new'' and as if bringing anything new has to do with it becoming ``widely adopted''. As usual if it's popular it's inferior.

software devs
You mean programmers you corporate retard?

Stupid eurotrash kid.

Name: Anonymous 2013-12-21 21:08

Python is a objectively shitty language and is popular just because it is has a lot of libraries and doesn't take much of a brain to use. It isn't used in serious work either (being used for web work isn't serious, regardless of it being used by amazon or google)

Name: Anonymous 2013-12-21 21:19

it's used by biochemists, physicists, and astronomers every day. btw i also use it at my current employer (tip: its a large number)

Name: Anonymous 2013-12-21 21:24

>>125

indians and undergrads are programmers, i'm a software developer. nay, a software engineer

Name: Anonymous 2013-12-21 21:35

>>127,128
5/10.

Name: Anonymous 2013-12-21 21:40

lol.i know it's hard for you to realize you are definitely 100% wrong about this (with corporations and academia backing this up) but once you graduate (provided you can finally pass that pesky algorithms course) and start actually making software you will see

Name: Anonymous 2013-12-21 23:02

>>126
being used for web work isn't serious, regardless of it being used by amazon or google)

You are not a very smart man.

Name: Anonymous 2013-12-22 0:25

I've noticed there has been a recent influx of imageredditors. Some are trying to fit in and some aren't.

Name: Anonymous 2013-12-22 0:26

>>131
I ace every IQ test I get and my balls are the size of your kidneys. Fuck off, kiddo.

Name: Anonymous 2013-12-22 1:05

>>132
Maybe we're just conspiring to act less intelligent.

>>131
Python should be treated as a dab of glue that connects a library to your application with minimal effort, or as just another quick and dirty scripting language. It should never be used for anything serious, as things that are serious are generally required to scale to a larger size, which isn't one of python's strong points.

Name: Anonymous 2013-12-22 23:55

>>132
The link to this site has probably been bumped on the old /prog/.

Name: VIPPER 2013-12-23 16:05

>>132
You are starting to being annoying

Name: Anonymous 2013-12-23 21:29

>>136
You're the one who's always been annoying. Fuck off.

Name: Anonymous 2013-12-24 6:45

come on now, you don't need to be so irritable.

Name: VIPPER 2013-12-24 10:08

>>137
upset?

Name: Anonymous 2013-12-24 15:56

Are mutable String types bad design?

Name: Anonymous 2013-12-24 16:18

>>139
Yes, I'm upset. That ``lol im so troll XD'' attitude of yours is what pisses me off. How about you contribute once in a while instead of making off-topic comments on every thread you find?

Name: VIPPER 2013-12-24 16:26

>>141
I will just say ``NO U''
that's all, stay mad

Name: Anonymous 2013-12-24 16:56

>>140
I think a `string' should just be a [family of] data structure[s]. Sometimes I want to arbitrarily set certain characters in an enormous string to `B' without changing the length of the string. I should be able to do so without obeying a mandate that `strings must not be mutable!'. Sometimes I want to know that my strings never change once they are created. I should be able to do that as well. Sometimes I want to split strings at arbitrary points and shuffle the pieces without creating 2 (3? 4?) extra copies of the string to do so. I should be able to do all in the same program, even.

I think the problem is that strings are seen to be all of the same datatype, when really they shouldn't be. There are lots of ways to implement a vaguely defined List, so there should be lots of ways to implement a vaguely defined String. I don't often give Java a lot of credit, but I think their StringBuilder is at least on the right track, in that it is an object structure that could allow efficient modifications to parts of the string (including growing/shrinking) while also making an attempt to keep memory usage down.

That said, a lot (perhaps most) of the time strings are used, they aren't mutated at all, so an immutable string type would allow compilers/interpreters to pull some tricks, and programmers would be able to formalize their desire that the text `Fatal Error' not be changed to `Success!'.

Name: Anonymous 2013-12-24 20:17

>>142
Don't worry kiddo you'll get bored of textboards sooner or later.

Name: VIPPER 2013-12-24 20:55

>>144
Okay, have fun

Name: Anonymous 2013-12-25 21:59

How come you can inject generic code into php but can't do so in other scripting languages?

Name: Anonymous 2013-12-26 23:01

>>146
What makes you think this is exclusive to PHP? Every language with an eval function/statement/annotation/type in a Touring-complete type system is potentially vulnerable to code injection.

Name: Anonymous 2013-12-27 0:56

>>147
But you can inject any code you want into php if it is not sanatized properly even without eval, right? With Perl and the like you cant do that without eval or an sql querry or whatever.

Name: Anonymous 2013-12-27 5:12

>>148
No difference. Code written in PHP simply tends to be used in ways that make eval more common than they tend to be in, say, Perl. Combine that with the stellar reputation of PHP coders and your answer becomes clear.

That said, there are plenty of places around the internet, if you look, that offer code injection through languages that are not PHP. I remember a classic one in which an online calculator was implemented by taking the contents of a textbox, erasing the characters ', `, and ", and then passing it raw to Perl's eval. From the time it was posted on /g/, that calculator went from things like performing morse code translation to listing /etc/fstab to starting shells to installing kernel exploits (the kernel was something like 2.2) to finally being overwhelmed by some jackass who decided to test the process limit by forkbombing.

Name: Anonymous 2013-12-30 0:54

I'm a little buzzed up and I don't know exactly how to word this question right. But a new compiler has to be written in older compilers, obviously. Do they become increasingly more inefficient? Can all current compilers be traced back to few initial compilers?

If I compiled the source code of a compiler with a given compiler, then used the new compiler to compiler the original source, and kept doing this, would it become increasingly more inefficient?

What's a good book for studying compiler design?

Name: Anonymous 2013-12-30 1:24

>>150
Principles of Compiler Design, often referred to as The Dragon Book.

Name: Anonymous 2013-12-30 3:00

>>150
The speed with which your compiler compiles code is not related to the speed with which the resulting code runs. You could write a C compiler in JavaScript which would produce code which was faster than JavaScript. Don't, though.

Name: Anonymous 2013-12-30 15:45

>>151
Green, Red, or Purple dragon book?

Name: Anonymous 2013-12-30 21:43

>>153
All of them.

Name: Anonymous 2014-01-10 18:42

How does the following work? The second field (unsigned 1 bit) oscillates between -1 and 0. If one bit is reserved for the sign, how can it change at all?

#include <stdio.h>

struct {
unsigned int a : 1;
int b : 1;
unsigned int c : 2;
int d : 2;
} test;

int main(void) {
int i;
test.a = test.b = test.c = test.d = 0;

for(i = 0; i < 15; i++)
printf("%d:%d:%d:%d\n", test.a++,test.b++,test.c++,test.d++);

return(0);
}


I never understood why the negative min was always one larger than the positive max. From a mathematical point of view, the mins and maxes for a 8 bit signed int should be 11111111 (-127) and 01111111 (127)

Name: >>155 2014-01-10 18:46

First instance of unsigned should read signed

Name: Anonymous 2014-01-10 19:33

>>155
Range of a signed byte is -128 to 127. In signed representation, if the first bit is "1", the operation becomes:

-(2n-1) + (value of n-1 bits of the number)

i.e.,


10000000 = -128 + 0 = -128
10001000 = -128 + 8 = -120
11111111 = -128 + 127 = -1


All 0s in a bitfield is always 0, even in 2's complement. But just 1 in a 1-bit number is equal to:


-(2^0) + 0 = -1


Or, more realistically, because the maximum value of a 1-bit field is 1, and you're forcing the compiler to represent its only available bit as the sign bit, it has no other bits to add to it, so it will always be between 0 and -1.

I wonder if doing this is undefined behaviour?

Name: Anonymous 2014-01-11 16:06

>>155
You are thinking of sign magnitude, where the most significant bit represents the sign of the number while the remaining represent the magnitude. In this scheme, the range of values for negative and positive numbers are equal, but there are two representations for zero, 10000000 and 00000000.

>>157-sama is using 2's complement, where -x is obtained by performing ~x + 1. That is, interpreted as an unsigned value, the bits are flipped and the number is incremented. Using this representation, there is a unique representation for zero, but since there is only one representation for zero, the number of positive values cannot be the same as the number of negative values, since these with the zero representation would give an odd number of total values, which is not a power of two. So there will be an extra positive value or a negative one. In 2's complement, the extra value is negative. This means there is a strictly negative number that is fixed under the absolute value function, so the result of absolute value isn't necessarily positive. Hopefully programmers use integers that are large enough to avoid this behavior.

Name: Anonymous 2014-01-20 4:31

I had an idea for a program... I was going to write a quick program that converted units like:
./convert 120 in mm

I planned on having an external text file where I could add definitions like
in 2.54 cm
cm 10 mm

My intention was not to require the text file to have every possible combination of conversions, but to be able to use multiple conversions in order to get the final conversion. I thought linked lists might be a way to do this. Something like:

typedef struct unit {
char *name;
unit **nodes;
double *factors;
} unit;

The problem is the linked lists wouldn't really be linear or circular, just arbitrarily linked together with some nodes linking to many others. And what's worse, some linked lists would be completely independent from others (different dimensions). Is there a way to search through linked lists like that without an infinite loop?

Name: Anonymous 2014-01-20 5:50

>>159
Thats not a linked list you're talking about but a graph. And there are plenty of (great) ways to search a graph.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List