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: Anonymous 2013-12-04 11:59

Why aren't you programming in Ruby like a real Nihonjin?

Name: Anonymous 2013-12-05 9:56

>>87
Interpretation is necessary when the user is provided with a console where ey may enter commands at run time to be interpreted as commands within the programming language. Embedded scripting is a good example of interpretation done in the right place. Also cgi scripts and such, although those too can be compiled and cached.

Name: Anonymous 2013-12-05 15:02

>>91
Real Nihonjin write badly formatted Sepples for Win2K.

Name: Anonymous 2013-12-05 20:17

Ruby? Is that what nihongogah use to write super famicom games >>91-domo?

Name: Anonymous 2013-12-11 7:04

Why do you hate Python? Is it really just because of the indentation? You are going to indent your code anyway so why bother? Or do you people really like braced languages so much and would rather argue which bracing style is the best?

Name: VIPPER 2013-12-11 7:08

>>95

if (this_is_a_very_big_function_name (1, things,
more_things,
even_more_things))
if (1 + 2 + 3 == 5 && 2 + 5 + 3 + 10 + 9 + 7 == 4
&& 3 + 9 == 8 || 3 + 5 == 7
|| (1 + 2 == 5 && 8 + 3 + 6 + 2 + 6 + 2 + 7))
;

Name: Anonymous 2013-12-11 11:29

>>96
Why'd anyone who can program do it like that anyway?

Name: VIPPER 2013-12-11 11:57

>>97
because he is not a nigger

Name: VIPPER 2013-12-11 12:07

check my d-bus

Name: VIPPER 2013-12-11 12:09

>>99
nice dbus!

how about mine?

Name: Anonymous 2013-12-11 13:03

>>95
I don't really hate Python, but I'm unsatisfied with it, and there are other languages that fulfill the same role better, so I use them.

Sure, I hate the indentation (I believe that since you aren't supposed to see whitespace at all, it shouldn't have any effect on a program), but the philosophy behind Python (there should be one way to do it, and that way should be obvious) really just strikes me as incorrect. Really, Guido? There should be only one way to do something, and it should be obvious? Then why the fuck didn't you just write my program for me, since it's so obvious, and build it into the language? Writing in Python is a fine experience when you want to do things that the language designers predicted you'd do, but it becomes incredibly awkward if you have to write something they didn't think of.

To their credit, those situations don't come up often, even when you take into account that OOP is slapped onto the language in some places, and not in others. But it only takes one time to run into the brick wall of ``We didn't think you'd want to use this construct like that, so this feature that should be trivial is missing and to build it in yourself would take more space than the rest of your program'' to turn you off.

I can't remember what it was for me. I think I was trying to do something with map and object construction intertwining, and I spent ages beating my head against the documentation, thinking I just didn't know enough Python, and finally I found some blog (by somebody who evidently did know enough Python) and it turned out the only way was to have two layers of objects and use one type as a proxy for the other in a manner that was incredibly awkward. And since ``Not writing awkward code, and being able to write it quickly'' was Python's selling point, and since it had failed at both for my particular task, I dropped it like a sack of rotten potatoes and used Perl for everything I would have used Python for. I'm no better at Perl now than I was at Python then, but I've never run into that problem again.

I know you're probably saying to yourself ``Well, you must have been doing it unpythonically to get into that situation in the first place,'' and you're probably right, but I don't care. As a language, Python advertises itself as being the choice where that doesn't happen, because all the subcomponents of the language are so intuitive that once you know a decent bit about the foundations, everything else just falls into place and you can worry about your algorithms and flow control. There are other languages that fill the same niche as Python, so it doesn't have a lot of leeway on failing to come through on those claims.

Name: Anonymous 2013-12-11 21:24

>>101
Ruby, PHP, or Python.
You are forced at gunpoint to choose. Which one, and why?

Name: not >>101 2013-12-11 21:37

Python; array handling is decent (unlike PHP) and there's no variable scoping mess like in Ruby.

Name: Anonymous 2013-12-11 21:37

>>102
Take the gunshot.

Name: Anonymous 2013-12-11 23:21

>>102
Assuming I can't follow >>104 's advice, I'd pick Python in a heartbeat.

PHP, above everything listed in A Fractal of Bad Design, is (apart from truly perverted setups) a lock into web development. Sure, it's on the backend, so it's not quite the same kind of cancer that Javashit is, but I don't really want to spend the rest of my life writing interfaces to various databases, CMS software, and/or shopping carts.

My reason for despising Ruby is mostly a cop-out; I'll just say that the Ruby community (even beyond Rails) is a cancerous bunch. I do actually have reasons for disliking Ruby, even on a technical level (I hold it to be a prime example of why Reference Implementations are a horrible concept, for example), but I haven't ever bothered to organize my thoughts on the matter, and frankly I don't care to. Ruby doesn't deserve that much of my time.

Python, for all its insufferable smugness, is a language in which I have done some non-trivial things, and therefore know they can be done. I think that for any problem or project that I would be interested in, there are better languages, but that doesn't mean Python is completely useless as a tool for all such problems/projects. PHP is.

Name: Anonymous 2013-12-12 5:42

>>102
PHP

Name: Anonymous 2013-12-15 9:05

>>102

I'd rather use Ruby than anything you listed.

Name: Anonymous 2013-12-16 0:47

>>102
FIOC or Ruby.

PHP is an outright insult and being shat on the face, the others are kind of like calling you a nigger ``jokingly'' and realizing they really mean it after you're deep in.

Name: Anonymous 2013-12-18 1:54

Why do programmers name their variables i when they use for loops? Who started this convention?

Name: Anonymous 2013-12-18 2:16

>>109
Some may argue it started with FORTRAN, COBOL or some other ``oldskool'' language, but it obviously has to do with mathematics. I don't even know why you're asking that question, everyone here should at least have taken a course on linear algebra.

Name: Anonymous 2013-12-18 6:48

>>95
"People hate Python because of forced indentation" has got to be one of the biggest strawmans in programming history, but it is a perfect summary of the Python community, which will ignore any real issue the language suffers from.

I personally dislike Python because it has ridiculous flaws a proper language shouldn't have to deal with. Scoping issues in 2013? List comprehensions with messy semantics in favor of clean higher-order functions? Why is self a thing? Why is nonlocal/global a thing? If forced indentation is so good, why do you have to introduce noops like pass in order to have an empty block? It should be obvious it's empty from the indentation, no? The same thing goes for the colon after each statement. What's the point? Python also lacks a numerical tower, which doesn't go well with the whole "errors only show up when they actually happen" thing you can attribute to Python's lack of static typing and overly dynamic nature - have fun hunting silent errors. Finally, it doesn't offer anything new; there is no feature specific to Python that would make me ignore these flaws for the time being. It's yet another scripting language with no redeeming feature, a ton of flaws, and a poisonous community that suffers from guru worship (a sign that the community is incompetent, similar behavior can be observed in Clojure and C++) and refuses to fix these language flaws.

The list could actually go on, but I don't want to write yet another essay on why Python is "teh suck". Long story short: Indentation is its smallest problem.

Name: Anonymous 2013-12-18 12:26

Why isn't there a FOIC version of C? Is it possible to write C such that it follows everything in da standard except the use curly braces to delimit blocks?

Name: Anonymous 2013-12-18 20:56

>>112
Because that would be dumb, and nobody wants to either make or use such a thing.

Name: Anonymous 2013-12-19 17:19

Is [i]coroutine[/i] considered harmful?

Donald Knuth once said:
Subroutines are special cases of ... coroutines.

I would add:
Coroutines are special cases of ... goto statements.

Name: Anonymous 2013-12-19 17:46

>>114
Most flow control is a special case of goto statements, but considering things harmful as a blanket statement is a terrible idea.

Name: Anonymous 2013-12-20 15:07

>>111
i agree with you that people arguing about FIOC (or really any similar syntactic complaints) have no idea about actual language design or use

what are the "messy" semantics of list comprehensions?

why is self a thing? to reference the current object? if you mean why is explicit self a thing, it's because explicit is better than implicit

global is a thing because more often you are going to be declaring local variables with the same name as global variables than you are going to be reassigning global variables. furthermore it discourages use of global variables to keep mutable state

again, pass being explicit is good for the sake of being explicit, plus it is easier to read "while spinning: pass" than it is "while spinning:"

one of your complaints is colons? seriously?

dynamic typing is not a valid complaint against a language, it's your personal preference

python's benefits are large and comprehensive static libraries, easily readable code, and the ability to directly use low-level procedures and structures in high level code.

i'm not saying python is a perfect language, just that your complaints are ridiculously stupid. here are some valid complaints:

lack of tco
cpython
handling of strings (e.g. 'c'[0][0][0][0][0] == 'c')
comparisons with None and booleans being int (this might have been fixed in 3.x+?)

Name: Anonymous 2013-12-20 15:08

>>116

s/static/standard

Name: Anonymous 2013-12-20 15:32

>>116
I honestly tried to read what you said, but I couldn't finish it because of your complete lack of capitalization and the confusing way you flow in and out of quotes/rhetorical questions. From the little I read, you seem to have completely missed the point >>111 was making about Python's syntax, which is that it has flaws like self which make its design self-contradictory. I would add that a clean syntax is one of Python's core selling points. If being explicit is good, then why is it `pythonic' to use the colon-appendation instead of consistently using a function named something like append? If, on the other hand, syntactic brevity is desired, then as >>111 pointed out, use of : in flow controls is unexpected and makes no sense. If a language which advertises itself on the basis of good syntax can't get good syntax right, why should I bother with it?

I don't know if you bothered to move on to something more interesting by the end of your post. Maybe if you reformat it I'll read it. Probably not.

Name: Anonymous 2013-12-20 16:41

>>118

tell me again how self is contradictory to python's design

again, if your only complaints against a language are about its syntax, you have absolutely no business criticizing it or engaging in discussion about its design. go read baby's first plt textbook until you have something meaningful to contribute

Name: Anonymous 2013-12-20 18:41

>>119
Fuck off back to /g/ nigger.

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.

Name: Anonymous 2014-01-20 6:28

>>160
Well it's not quite a linked list, but it's not a graph either.

ft may be linked to in, cm, mm, and miles. miles may be linked to ft, km, and m. Maybe m is only linked to km. nm may be linked to mm and light years.

There is a way to search through that without it infinitely looping through it?

Name: Anonymous 2014-01-20 6:33

>>161
I just realized I think this can be searched through easily, but imagine there were every more links that looked circular.

Name: Anonymous 2014-01-20 7:46

>>161
It's definitely a graph.

Name: Anonymous 2014-01-20 12:04

just base everything off the standard units? every unit has a base unit.

http://en.wikipedia.org/wiki/International_System_of_Units

so to convert mm to nautical mile you first find out how many mm to a meter (the std unit) and then convert meter to mile.

you could even do things like "./convert 10 miles per hour to km per week"

Name: Anonymous 2014-01-20 13:42

>>159
What, you mean like units?

$ units
Currency exchange rates from 2013-07-11
2562 units, 85 prefixes, 66 nonlinear units

You have: 120 inches
You want: millimeters
* 3048
/ 0.00032808399


You might look at how they do it.

Name: Anonymous 2014-01-20 21:11

>>165
Or frink.

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