[ / / / / / / / / / / / / / ] [ dir / arepa / bestemma / kc / lolnada / orbg / soyboys / tisminc / vg ][Options][ watchlist ]

/tech/ - Technology

You can now write text to your AI-generated image at https://aiproto.com It is currently free to use for Proto members.
Name
Email
Subject
Comment *
File
Select/drop/paste files here
Password (Randomized for file and post deletion; you may also set your own.)
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Expand all images

File (hide): 9d232e96794622f⋯.jpg (29.04 KB, 698x294, 349:147, notokay.jpg) (h) (u)

[–]

 No.896410>>896411 >>896413 >>896419 >>896803 >>897503 [Watch Thread][Show All Posts]

This is NOT Okay

 No.896411>>896418 >>896528 >>897014

>>896410 (OP)

wtf C

int main(void)
{
char *s = "hello world";
*s = 'H';
}
This is NOT Okay


 No.896413>>896415

>>896410 (OP)

It's cool to shit on a shit language, but at least learn to use it correctly first.


 No.896415>>896523

>>896413

Weakly typed languages are shit, there is nothing more to learn about it.


 No.896418>>896420

>>896411

Op here

C is also weakly typed shit, horrible all around.


 No.896419

>>896410 (OP)

>screenshot

>jpeg

This is NOT Okay


 No.896420>>896422

>>896418

>disliking C

This is NOT Okay C is a gift from GOD (Denis Ritchie is the only real god. Fuck off with your fake ass gods)


 No.896422>>896425 >>896459

>>896420

And where is you god now? Dead, lol.


 No.896425>>896426

>>896422

So? All the other fake gods are dead too. Only difference is that the real GOD (Dennis Ritchie) actually existed and actually created something that is worthy of being called a Wonder. C is literally perfect and if you disagree you are a NIGGER (unless if you think that Rust is good than you are even worse than a NIGGER)


 No.896426

>>896425

I don't believe in the bible and I don't believe in the greatness of C.


 No.896429>>896431

>muh js boogeyman


 No.896431>>896439 >>896440

>>896429

So the above image is representative of good language design?


 No.896439>>896445

>>896431

It is representative of a dumbass abusing language behavior.


 No.896440>>896442 >>896445

>>896431


> var d = new Date();
undefined
> d.getTime()+1000
1523451581683
> d.toUTCString()+1000
'Wed, 11 Apr 2018 12:59:40 GMT1000'


 No.896442>>896445

>>896440

Oooh noeees, what will we doooo if a language designed for string edition doesn't panic when trying to sum a string and a number because you probably want to concat them?


 No.896445>>896447 >>898668

>>896439

>>896440

>>896442

>I want my language to silently propagate fucked up values throughout the execution path of the codebase instead of throwing a type error at the exact location of the issue


 No.896447>>896448

>>896445

Have fun at peak stupid.

You are just making excuses for not being able to write simple programs on a simple language that any cum guzzling san fran faggot can.

You are an armchair developer.


 No.896448>>896450

>>896447

Yeah why do we have errors at all? The interpreter / compiler should just throw in some defined behavior for anything the user could possibly do. You want call a number as a function 35()? Lets make that do something.

Any fucking 8 year old can use scratch or gamemaker or visualbasic or whatever the fuck kids learn on. You take the fact that 8 year old retards can use it and conclude "oh huh must actually not be that bad, i'm sure the code is easy to debug if you have trouble working out complex systems in these 'simple' languages you must be retarded"

lol


 No.896450>>896454

>>896448

>waaah waaaah i cant program without a compiler/interpreter holding my hand waah waaah


 No.896454>>896455

>>896450

I agree, why even have the computer do any work for you. Real programmers write everything in assembly entered one byte at a time into a mainframe. If you want a system capable of detecting errors automatically you must be a dumb faggot who could not possible write anything.


 No.896455>>896456

File (hide): 7981b9eb270ef7b⋯.png (306.14 KB, 593x540, 593:540, 798.png) (h) (u)

>>896454

> If you want a system capable of detecting errors automatically you must be a dumb faggot who could not possible write anything.

Not really, but if you are so butthurt about not being spoonfed at all times that you feel the need of making retarded threads based solely on your own stupidity to justify your argument, you sure is pathetic.


 No.896456>>896457

>>896455

What kind of dumb faggot would argue about bullshit all day? Not you and me that's for sure.


 No.896457>>896460

>>896456

I just like to make fun of butthurt faggots.


 No.896458>>896460 >>896465

File (hide): db88b984b96f4e5⋯.png (25.05 KB, 344x312, 43:39, genius programmer.png) (h) (u)

HURR DURR THIS IS NOT OKAY, OKAY???


 No.896459>>896460


 No.896460

File (hide): d90a03e3af17ebb⋯.jpg (6.66 KB, 444x200, 111:50, DZ-s6YoXUAMOvgb.jpg) (h) (u)


 No.896465>>896468 >>896470 >>896695 >>897373

>>896458

The concatenation operator should absolutely not be '+'. Sometimes people want to do "100" + "32" == 132, which doesn't work in Zhgrabbjascript.

Choose a different fucking concat operator for fuck's sake. Lua does it right. "100" .. "32" == "10032"


 No.896468>>896472

>>896465

Its a shame lua does everything else wrong. The table system my god.


 No.896470>>896472 >>897373

>>896465

>Sometimes people want to do "100" + "32" == 132

Why are you treating strings as numbers? If you really insist then it isn't that hard to do Number("100") + Number("32")


 No.896472>>896475 >>896476 >>896480

>>896470

I don't want to have to write extra Number() calls everywhere. In juhblubberscript, which is weakly typed, people will do things like "100" + "32". Having that extra operator reduces the code length and line length, increasing readability, while also making sure the programmer doesn't have to worry about whether it the type system will work in his favour.

>>896468

What's wrong with the table system in Lua?


 No.896474>>896482

File (hide): a0435777775d7a9⋯.png (14.12 KB, 375x82, 375:82, C.png) (h) (u)

C can sum a number and a string too


#include <stdio.h>
void print_string(char *s, int length)
{
for (int i=0; i<length; i++)
{
printf("%c",*s);
s++;
}
printf("\n");
}

int main(void)
{
char *s="Thu Dec 14 2017 12:30:41 GMT-0700(MST)";
int length=38;

print_string(s, length);
s=s+100;
print_string(s, length);

return 0;
}


 No.896475>>896478 >>896482

>>896472

Again, why are your numbers strings?


 No.896476>>896478 >>896482

>>896472

If you weren't a brainlet, you would know you can just use + to convert a string to a number.

+100 + +32

But as the other anon asked, why are your numbers strings?


 No.896478>>896975

>>896475

>>896476

How about we just let things be what they are. Strings are strings, numbers are numbers, objects are objects.


 No.896480>>896481 >>896490

>>896472

>I don't want to have to write extra Number() calls everywhere.

I've been messing with gtk with C lately. This reminds me of of this. Consider this snippet


GObject *scrolled_window_result;
scrolled_window_result=gtk_builder_get_object(data, "scrolled_window_result");

/* create new result table */
GtkWidget *grid = gtk_grid_new ();

gtk_container_add( GTK_CONTAINER(scrolled_window_result),
grid);
gtk_widget_show(grid);

/* fill the grid */
for (int i=0; i<10; i++) {

for (int j=0; j<10; j++) {

GtkWidget *entry=gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(entry), "Test");
gtk_grid_attach(GTK_GRID(grid), entry,
j, i, 1, 1);
gtk_widget_show(entry);
}
}

in GTK almost every pointer has to be either cast to something else to send to another gtk function, or cast using one of their own functions which is casting + bloat.


 No.896481>>896484

>>896480

GTK/bloat


 No.896482>>896483 >>896531 >>896943

>>896475

Some of my numbers are strings because:

* they come from reading files

* they come from user input

* they come from parsing a string

etc.

And then if I wanted to write them back to a file or print them to stdout I would have to write string(x) everywhere. Weak typing has its advantages, but the (severe) disadvantages need to be reduced through fixes such as the one I suggested.

>>896476

I don't like it. Why would I waste my precious line space on that? Also it looks ugly.

>>896474

>that print_string() function

dumb fuck, stick to something a little easier for you


 No.896483>>896487

>>896482

>I don't like it.

Then shut the fuck up and fuck off. No one like stupid bitching. Or take it to the people writing the standard.


 No.896484>>896485

>>896481

gtk has also seen fit to create their own data types replicating every C type.

https://developer.gnome.org/glib/stable/glib-Basic-Types.html

char a='a';

<wrong

gchar a ='a';

>correct


gchar
typedef char gchar;
Corresponds to the standard C char type.

glib is a wonderful creation


 No.896485

>>896484

But of course, what if the char type changes one of these days?

:^)


 No.896487>>896488

File (hide): c1dc888e122f6e0⋯.png (512.77 KB, 1280x720, 16:9, laskdjhfalsdhlfaksjdhf.png) (h) (u)

>>896483

>I've run out of arguments


 No.896488>>896491

>>896487

I ran out of arguments? Your argument is literally "i don't like it".

I just called you the little bitch you are.


 No.896490

>>896480

This is because c has a weak as fuck type system where everything has to be void* to be generic.


 No.896491>>896493

>>896488

>ignoring the rest of my statement

>quoting out of context

Ok, let me restate my arguments because you couldn't understand English.

* Increased line length (significant for longer statements)

* Less easy to read


 No.896493>>896495 >>896496

>>896491

>1 character per conversion is too long

Either you are retarded and has to convert shit all over the place or you are autistic to care about negligible amounts of code.

>less easy to read

Well, I assume you have issues with written language in general. Specially because anyone somewhat literate would use "harder" instead of "less easy".


 No.896495

>>896493

>complaining about word use on an image board


 No.896496>>896499

>>896493

>1 character per conversion

Usually you wouldn't convert literals like that.


local nigger = 100
local faggot = 32
local retard = +nigger + +faggot
local god = nigger..faggot


 No.896499>>896504

>>896496

Why did you even make those two variables to begin with? Are you just pretending to be retarded? I got to stop taking the bait tbh.


 No.896504

>>896499

What? It's just an example, tard. Replace them with foo and bar if you're too triggered.


 No.896523>>896813 >>896840

>>896415

Weak dynamic typing < strong dynamic typing < weak static typing < strong static typing


 No.896528>>896530

>>896411

>i want to do something retarded and the compiler will let me


 No.896530>>896628

>>896528

Yeah experts who have been writing c for 30 years never make mistakes. We never get massive security holes in important applications because of some trivial error that could have been caught at compile time by any non retarded language. We should expect absolute perfection from authors of programs in complicated situations.


 No.896531

>>896482

>* they come from reading files

>* they come from user input

What if the file is not formatted correctly?

What if the user typed one instead of 1?

Strings are not guaranteed to be numerical.


 No.896581>>896651 >>896682 >>896691

Most of this JavaScript bullshit comes from UNIX and UNIX languages like C and awk. What is that bizarre number? It's UNIX time times 1000. When that number was 0, UNIX sucked. When that number overflows, UNIX will still suck.

What a paragon of reliability.  Speaking of time, could it
be that now that it's well past the 20-year mark, Unix is
starting go go a little senile? Why, not too long ago, I
had a time server lose its clock, and all the other machines
on the net happily decided that they, too, were back in
1970. Kind of like your roommate's great aunt who the
police keep bringing back from the other side of town 'cause
she thinks she still lives in the house where she grew up
years and years ago...

"... sometimes, they even boot spontaneously just to let you
know they're in top form..."

(retch)

This appeared in a message requesting papers for the "USENIX
SYMPOSIUM ON VERY HIGH LEVEL LANGUAGES (VHLL)":

UNIX has long supported very high level languages:
consider awk and the various shells. Often programmers
create what are essentially new little languages whenever
a problem appears of sufficient complexity to merit a
higher level programming interface -- consider
sendmail.cf. In recent years many UNIX programmers have
been turning to VHLLs for both rapid prototypes and
complete applications. They take advantage of these
languages' higher level of abstraction to complete
projects more rapidly and more easily than they could
have using lower-level languages.

So now we understand the food chain of advanced UNIX
languages:

level languages analogous organism
----- --------- ------------------
low assembler (low-level PDP) amoeba
intermediate regular expressions tadpole
high C (high-level PDP) monkey
very high awk, csh, sendmail.cf UNIX man


 No.896628>>896635 >>896641 >>897485

>>896530

>I need a compiler to complain at me when I do something retarded when anyone can look at my code and see it is retarded


 No.896635>>896673

>>896628

t. someone who has never programmed anything before


 No.896641>>896643 >>896647 >>896691

>>896628

>a compiler to complain at me when I do something retarded

If the compiler did that, it would have solved a lot of problems. No C, no C++, no UNIX, no Java, and no JavaScript.

After a little headscratching, I realized that the leading
zeros in my frame numbers were causing cpp to treat them as
octal values. How precious.

But still, if I say "#define FRAME 00009" then "#if
FRAME==00009" should still fire (or it should at least whine
at me). Well, 00009==00009 does trigger, but so does
00009==00011.

Huh?

Well, some C library thinks that the nine in 00009 isn't
octal, so it interprets it as 9 decimal. And 00011 is a fine
octal rep of 9 decimal. So, both "#if FRAME==00009" and
"#if FRAME==00011" fired and I applied two translate calls
to my object geometry. And(!), it's not that having a
decimal digit makes the whole number decimal. The string
00019 gets interpreted as 00010 octal plus 9 decimal = 17
decimal. Lovely, not.


 No.896643

>>896641

If you are to block quote something atleast say what / who it is.


 No.896647>>896683

>>896641

>using #defines instead of const variables

>using leading zeroes in your fucking #define for a non-octal number

>abusing the preprocessor like this

You're a faggot for quoting this pajeet so much.


 No.896651>>896683

>>896581

JS is a dynamic language. It's been influenced by every other dynamic language before it, including Lisp. You're getting way too carried away with your Unix boogeyman , m8.


 No.896673>>896676

>>896635

>I want a compiler to complain about the exact situation where someone is retarded like the situation originally replied too.


 No.896676>>896678

>>896673

Why even have the compiler check variable names for you? A typo is retarded and anyone should be reading their code before they deploy it anyways. Preventing retarded basic failures is not the domain of the compiler after all.


 No.896678>>896681

>>896676

The fact is anyone can sit around all day and do retarded things with pointers.

Variable name typos aren't the samething at all. Compiler cant compile if you somehow place a random undeclared variable somewhere in your code what would it do?


 No.896681>>896690

>>896678

>what would it do?

I'm sure you could think of atleast on thing for it to do. Making it default a number to the machine width with a value of 0 for example. If its a situation where it could be a pointer replace it with NULL, etc. Most languages these days set it to a "undefined", or "null" value but they are usually dynamic.

>and do retarded things with pointers.

This is a bad thing. A language which makes it trivial to fuck up in a way that accesses random memory is a shitty idea.


 No.896682>>896685

>>896581

>the problem is UNIX

>and not pajeet tier programmers

>here is some copypasta from USENET

>I don't understand it myself and offer nothing of substance

>because I LARP on /tech/ all day instead of doing actual work


 No.896683>>896691

>>896647

How is the preprocessor supposed to know what the values of "const" variables are? In Lisp, the equivalent to that is possible, but this is C. Leading zeroes have nothing to do with octal except in the brains of UNIX weenies. Maybe adding one more zero should increase the base by one, so 019 is octal, 0019 is nonal, 00019 is decimal, and so on. If an AT&T employee put that in the C compiler in the 80s and it was part of the C standard, UNIX weenies wouldn't think there was anything wrong with it.

>>896651

That broken Date in OP's post doesn't come from Lisp. The number is UNIX time. JS was influenced by Lisp, but it still sucks. JS was more influenced by Perl and it shares the Perl philosophy.

Subject: Re: My First Perl Program


I don't know, seems about par for UNIX for untested, hacked
together software, thrown together on a whim and without
planning to be forced upon the entire universe without
warning. Sounds like sendmail... or finger.... or almost
any other unix utility.


>
> The question is not whether it is a reasonable expectation
> that you get a program right the first time when
> programming in a new language, but whether it is a
> reasonable action to force a large number of strangers to
> use it when you have already decided that it is not a
> reasonable expectation that it will work the first time.


 No.896685

>>896682

>Treating everything as strings is good

>If you get runtime errors in our shitty poorly typed system in your real software its all your fault and not at all related to our bad design


 No.896690>>896693

>>896681

No matter what you do it will be trivial unless you sacrifice speed the program.


 No.896691

>>896683

>>896641

>>896581

quoting random bullshit in code boxes to give it false importance should result bans


 No.896693>>896696 >>896719

>>896690

>unless you sacrifice speed the program.

<If you are not editing memory with a raw pointer for every trivial operation your program will be slow

This is so utterly retarded. There is a large set of abstractions you can implement that produce the exact same assembly while being way safer. If there are one or two cases where you need to do raw memory manipulation you can let people.


 No.896695>>896884

>>896465

>Sometimes people want to do "100" + "32" == 132, which doesn't work in Zhgrabbjascript.

>Number comes as string because it is user input

>User is retarded so he writes "face book" on it

>"" + "face book"

Either:

A) You get an error and the program crashes

B) You get a NaN

The first should be desirable because summing two strings as numbers if they happen to be numbers and returning a number is all sorts of retarded. The second would be even harder to debug than if it just returned "face book"


 No.896696>>896698

>>896693

Do you want the program to bounds check array?


 No.896698>>896700 >>896816

>>896696

>Do you want the program to bounds check array?

Unrelated to using raw pointers for everything. Bounds checking every access would be slow. It is better to write your programs in such a way such that you never index an array. While not always practical it usually is. For example using MAP and REDUCE compared to a manual for loop.


 No.896700>>896993

>>896698

But think of all the security flaws that can happen if people are retarded with arrays! The fact is you dont put your same logic in having arrays being unsafe and having pointers being unsafe. As long as its possible to use a pointer it will be trivial to access some random memory location.

A pointer is like a motorcycle. If you lean to much you will fall off. So don't lean too much simple as that. (edited quote from terry)


 No.896719

>>896693

>There is a large set of abstractions you can implement that produce the exact same assembly while being way safer.

>that produce the exact same assembly

you lie


 No.896803>>896874

File (hide): 70488a2c67f56f9⋯.png (5.55 KB, 440x108, 110:27, Untitled.png) (h) (u)


 No.896813>>896814 >>896818 >>896950

>>896523

So PHP/JS < Python < C < Java? Whatever, Pajeet.


 No.896814>>897239

>>896813

Purely in terms of type system, yes. That alone doesn't make the language better in every regard of course.


 No.896816>>896876 >>896990

>>896698

>bounds checking is slow

Wrong. You always benchmark your shit before you make any retarded claims.

https://blogs.msdn.microsoft.com/ricom/2006/07/12/cost-of-array-bounds-checking-one-experiment/

https://www2.cs.arizona.edu/~dkl/Publications/Papers/ics.pdf

Bounds checking certainly isn't free but the cost is in almost all cases negligible.


 No.896817

im dont wanna try n use that because i know the type of niggas on this app always tryna give me a virus


 No.896818>>897239

>>896813

>PHP/JS < Python < C < Java < microsoft visual basic


 No.896840

>>896523

Spoken like a true nodev.


 No.896874>>896893

>>896803

Protip:

[code]

const d = (new Date()).valueOf();

d + 1000;

[/spoiler]


 No.896876>>896928

>>896816

Your probably also think using [ ] operator vs pointers difference is negligible!


 No.896884

>>896695

>just crash the server

This is your brain on stupid.


 No.896893

>>896874

>[/spoiler]

Spottet the redditor pajeet.


(new Date((new Date()).valueOf() +1000));

I'm not sure why anyone would directly add a number to a date but fine.


 No.896928>>897208

>>896876

There is no difference! It's all syntactic sugar.


 No.896943

>>896482

>I would have to write string(x) everywhere

Small price to pay to avoid bugs caused by implicit type conversion:


5 + null // returns 5 because null is converted to 0
"5" + null // returns "5null" because null is converted to "null"
"5" + 2 // returns "52" because 2 is converted to "2"
"5" - 2 // returns 3 because "5" is converted to 5
"5" * "2" // returns 10 because "5" and "2" are converted to 5 and 2


 No.896950>>897239

>>896813

You have to admit that in a language like C where every bit can have critical meaning, having implicit numeric conversions everywhere is fucking stupid. I imagine they would have fixed a lot of things like that by now if not for the header model where there's no separation between new and old code.


 No.896975>>896989

>>896478

Nice tautology, it solves nothing.


 No.896989>>897004

>>896975

It solves a shit ton of things. Don't have to worry about type coercion constantly.


 No.896990

>>896816

3% difference is not slow? lol


 No.896993

>>896700

>But think of all the security flaws that can happen if people are retarded with arrays!

You can use map or whatever. In C every trivial little operation requires fucking with a pointer it cannot be escaped.


 No.897004>>897007

>>896989

I'm referring to your statements of "strings are strings, numbers are numbers". That's a tautology. What you probably mean is "what if we actually enforce strong static typing?"


 No.897007>>897008

>>897004

> What you probably mean is

lol no. static typing is not the same thing as not having type coercion. schema is dynamically typed but its strict about it.


 No.897008

>>897007

fucking auto correct every time *scheme


 No.897014>>897017 >>897021

>>896411

This is undefined behavior. It can crash if the compiler decides to put the literal in a read-only memory segment.


 No.897017>>897021

>>897014

char* is not read only memory


 No.897021>>897023

>>897014

>>897017

Which is why I seem to recall the code snippet will not compile. CC will complain about trying to cast a char* from a const char*


 No.897023>>897063

>>897021

works on my machine


 No.897063>>897065 >>897067

>>897023

Weird. Which cc are you using? Pic related uses GCC 5.4.1


 No.897065>>897067

>>897063

Ok nevermind, that wasn't the point, of course it complains if I declare it as const char.


 No.897067>>897069

>>897063

>>897065

Compiles but segfaults.


 No.897069>>897070

>>897067

>Compiles but segfaults.

Which is a bad thing


 No.897070

Oddly enough, the compiler doesn't even issue a warning.

>>897069

Really? I thought it was a good thing.


 No.897074>>897081

lmao fucking gcc


 No.897081

>>897074

Adrien the furry


 No.897208>>897210

>>896928

write code that uses the [] operator instead of pointer that replaces evert instance of O in a string to P faster then this

 
*string = whateverarray;
while(*string != '\0')
{
if(*string == 'O')
{
*string = 'P';
}
string++;
}


 No.897210

>>897208

Damn it I forgot to add char before the string


 No.897235>>897236

You did it 4 times to


 No.897236

>>897235

err nvm I am idiot


 No.897239>>897241

>>896814

>>896818

Well what about Python > C/JS > PHP > Java > VB?

>>896950

Why can't we have a faster version of Python that works on the web, beats Ruby, Perl, PHP and JS in speed, and have no type-based issues that goes WATman?


 No.897241>>897243

>>897239

because python is bad


 No.897243>>897361

>>897241

How so?


 No.897361>>897363 >>897553

>>897243

Performance, to begin with.

Then you have asinine syntax.

And don't forget unreadable significant whitespace.


 No.897363>>897366

>>897361

I never understood this complaint. In what way are you formatting your code that the whitespace is intrusive? I indent my code any any other language the same way


 No.897366>>897369

>>897363

It's not intrusive, it's unreadable and ugly. Having no brackets or block level separators is fucking awful to try to read, especially if you get some nigger that thinks an indent level of 1 space is in any way acceptable.


 No.897369>>897395

>>897366

Your code formatting software should be able to fix any whitespace formatting issues you could possibly have.


 No.897373>>897401

>>896465

>>896470

Weak typing and + for concatenation are acceptable on their own, but mixing them is a bad idea.

Like Lua, PHP is, surprisingly, very reasonable when it comes to this:

>>> "10" . "10"
=> "1010"
>>> "10" + "10"
=> 20
>>> "10" - "10"
=> 0
>>> 10 . 10
=> "1010"
>>> 10 + 10
=> 20
>>> 10 - 10
=> 0

. is concatenation, + is addition. Treat numeric strings as numbers and it works out, treat numbers as strings and it works out.


 No.897395>>897554

>>897369

Imagine using a language that is so fucked up you need your editor to double as a crutch.


 No.897396>>897397

>>897394

What do you mean? A code block ends when the indentation level goes down to a previous indentation level.

It's intuitive enough to work with without knowing the exact details, but you can read a clear definition here, if you want something more formal:

https://docs.python.org/3/reference/lexical_analysis.html#indentation

>The indentation levels of consecutive lines are used to generate INDENT and DEDENT tokens, using a stack, as follows.

>Before the first line of the file is read, a single zero is pushed on the stack; this will never be popped off again. The numbers pushed on the stack will always be strictly increasing from bottom to top. At the beginning of each logical line, the line’s indentation level is compared to the top of the stack. If it is equal, nothing happens. If it is larger, it is pushed on the stack, and one INDENT token is generated. If it is smaller, it must be one of the numbers occurring on the stack; all numbers on the stack that are larger are popped off, and for each number popped off a DEDENT token is generated. At the end of the file, a DEDENT token is generated for each number remaining on the stack that is larger than zero.


 No.897397>>897398

>>897396

Indentation levels are not that clear, you have no distinction between them aside from how many pixels the line is apart from the margin.

Do you have in your brain an automatic pixel counter of sorts?


 No.897398>>897399

>>897397

I use four spaces, like God intended. That's more than enough to see the indentation level.

When I use a language with braces I also use indentation as a cue to see how many blocks deep I am. Human brains are much better at seeing where something is spatially than at counting braces.


 No.897399>>897400

>>897398

>counting braces

What the fuck are you talking about? Do you think identation and block deliminators are mutually exclusive?


 No.897400>>897402

>>897399

No, but when I use block delimiters they're for the lexer, and when when I use indentation it's for me. If the lexer understands indentation then I don't have to do both.


 No.897401

>>897373

If you use strings as numbers and don't care enough to convert your numbers into actual number variables, then you're literally worse than pajeet.


 No.897402>>897404

>>897400

You don't "do" identation, you use automatic identation from your editor. Your editor is able to know what goes where because of the delimiters.

Remove delimiters and you are manually identing shit like a fucking cave man.


 No.897404>>897405 >>897416

>>897402

Python uses a convention inherited from an earlier language's syntax where a statement that starts a block always ends with a colon. That's the cue for the text editor to increase the indentation, just like an opening delimiter.

If I want to leave a block I just press backspace, which decreases the indentation by one level.

It doesn't require any more manual work than delimiters do.


 No.897405>>897407

>>897404

Is the colon a requirement from the standard?


 No.897406>>897408 >>897413 >>897438

What's the least cancerous scripting language?, why do they all have to be (((object oriented)))?


 No.897407>>897409

>>897405

Yes. It's part of the syntax.

How much Python have you written?


 No.897408

>>897406

Lua doesn't have OOP at all and js doesn't force you into using it.


 No.897409>>897410

>>897407

That is not what I mean. Can the code run at all without the colon?


 No.897410>>897411 >>897414

>>897409

No, if you leave it out you get a syntax error.

How much Python have you written?


 No.897411>>897416

>>897410

Then why is the fucking whitespace even significant if you have a block delimiter?


 No.897413

>>897406

At the most basic level, object orientation is just a good way to attach functions to data structures. I have written object-oriented code without using any object-oriented language features, but it's nice if the language provides features to help you out.


 No.897414>>897416

>>897410

Also, I got right here a script that we use in production that has no colons after blocks and works perfectly well.

How much python have YOU written?


 No.897416>>897418 >>897421

>>897411

>>897414

It's only an opening delimiter. Please read >>897404 again.

>a statement that starts a block always ends with a colon.


 No.897418>>897420 >>897422

>>897416

Again, there is no closing colon here.

Only the opening one.


 No.897420>>897422

>>897418

A statement that starts a block always ends with a colon. It's the statement-starting block that ends with a colon. It's not the block that ends with a colon.


 No.897421>>897424

>>897416

And that doesn't change my question: if you are delimiting the blocks with symbols in one way or another, WHY IS THE WHITE SPACE SIGNIFICANT?

It is a completely redundant thing to just be a pain in the ass made redundant by other features.


 No.897422

>>897418

>>897420

block-starting statement, not statement-starting block, sorry.


 No.897424>>897426

>>897421

There's a (sort of) delimiter at the start. There's not a delimiter at the end, except for the DEDENT token computed from indentation.

Seriously though, have you ever written Python? I have my own complaints about whitespace indentation (and some other things about Python) but yours don't really make sense. They sound like something you came up with by thinking about it in the abstract without trying it.


 No.897426>>897431

>>897424

Ok, you are using a delimiter, I get it. It just doesn't explicitly ends a block. Ironic, considering python loves to meme "explicit is better than implicit", yet ends blocks implicitly by starting another.

Not to mention it is a shit delimiter because sometimes you have to end a block without starting another.

if (x) {

thing

}

more thing

For example. How can the editor know "more thing" is part of the if or the block that contains it? You didn't start another block and explicitly ended the if. Hell, how can it tell t he if isn't ending the block that contains it?


 No.897429

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

>how much python have you written

jesus what an autistic shitfest this thread is


 No.897431>>897434

>>897426

You're explicitly ending the block by decreasing the indentation. I'll walk you through the parsing. First, a pythonized version of the code.

if x:
thing

more thing
Now we count the indentation level of each significant line:
0| if x:
4| thing
|
0| more thing

At line 1, the indentation level is 0. We're not in a block. The indentation stack is [0].

At line 2, the indentation level is 4. This is higher than the previous indentation level, so an INDENT token is generated. We push the current indentation level on the stack. The indentation stack is [0, 4].

Line 3 is ignored.

At line 4, the indentation level is 0. This is lower than the previous indentation level. We pop items from the indentation stack until we get to the current indentation level. We pop 4, and generate a DEDENT token. Now the indentation level at the top of the stack is 0, so we're done.

Result:

if x:
INDENT
thing
DEDENT

more thing


 No.897434>>897436

File (hide): e8525907c19ee5a⋯.jpg (74.05 KB, 772x720, 193:180, charlie-sheen.jpg) (h) (u)

>>897431

And we are back at having to magically count pixels in our brains, the delimiter is absolutely fucking useless and the editor can't know for sure what is what.

That is your brain on python.


 No.897436>>897440 >>897463

>>897434

The delimiter is good for readability and also serves as a cue for the editor to increase indentation.

Don't you use indentation to see how many blocks deep you are in your code? Counting indents is trivial if you use them sensibly.


 No.897438>>897439 >>897542 >>898667

>>897406

Aside from Java and C#, no major language is really pure Object-Oriented.


 No.897439>>897440

>>897438

What does "pure Object-Oriented" even mean?


 No.897440>>897443

>>897436

The delimiter is USELESS since invisible characters are dictating blocks anyway. This is the thing, that guido faggot figured that characters help to visually identify shit, why did he even bother with significant white space making everything pure non-sense? Why not having another character ending blocks too?

>Counting indents is trivial if you use them sensibly.

IMAGINE having to count blocks to begin with. Have you ever used a sane language where you don't have to do menial bullshit for absolutely no good reason? Or you have spent your whole life sucking guido's farts?

>>897439

A language that doesn't support any other paradigm aside from OOP.

C++ for example, supports bona-fide OOP with classes, inheritance and shit but you can also write 100% procedural code.


 No.897443>>897446

>>897440

Python genuinely doesn't force me to do any more menial bullshit than braced languages.

If I want to start a block in a braced language, I press space, then {, then enter. If I want to end a block in a braced language, I press }, then enter.

If I want to start a block in Python, I press :, then enter. If I want to end a block in Python, I press backspace.

By "count" I mean "understand how deep I am relative to the other code". I use indentation to do that in python and in braced languages. Don't you?


 No.897446>>897448 >>897458

>>897443

No, I look at the beginning of the block.


 No.897448>>897450

>>897446

Given braces, do you prefer to have indentation along with them, or do you not care either way?


 No.897450>>897451 >>897454 >>897458

>>897448

Of course I prefer with indentation. But the core of blocks are the symbols. Your question should be:

would you rather go without indentation or delimiters? In which case I'd go without indentation any day of the week.


 No.897451>>897454

>>897450

The stupidity of python is somehow tricking retards into thinking you can have only either instead of both. Why do you even gain by not having delimiters? Why cripple legibility for no reason at all?


 No.897454>>897457

>>897450

I'd rather go without delimiters. Indentation is really easy to process mentally.

>>897451

Nobody thinks that. But delimiters don't affect legibility for me. They do introduce the risk of the delimiters and the indentation disagreeing, which is bad.

Go write some Python. Inform your opinion. It won't hurt.


 No.897457>>897458 >>897459 >>897461 >>897564

>>897454

>Nobody thinks that.

Bullshit. The first argument python cultists like to throw around is "BUT DONTCHA USE INDENTATION" as if I am proposing people to stop indenting their code just because I say white space shouldn't matter as far as syntax goes.

And there is no risk of delimiter disagreeing with indentation, delimiters are ALWAYS right. They can only disagree if you do something stupid like white space be significant. Try to think outside of the ONE SINGLE language that people do a fuck about and uses significant whitespace and you might realize it is a god awful idea.


 No.897458

>>897446

>>897450

>>897457

>Spends all day on someone elses imageboard because his is such shit


 No.897459

>>897457

>that people do a fuck about

what


 No.897461>>897467

>>897457

Delimiters are always right. So when the indentation is wrong you may be misled about the structure of the code.

But if the indentation is always right, and you don't have delimiters, then that danger goes away.


 No.897463>>897464

>>897436

You know what else is good for readability? Having a delimiter on both ends of the fucking block!


 No.897464

>>897463

Why do you need that if you've got indentation?

I never have trouble seeing the structure of Python code.


 No.897466

Paying to the delimiters makes sense if they're the only thing you can really trust, but that's not the case for Python.


 No.897467>>897470 >>897564

>>897461

>you may be misled about the structure of the code.

No because your editor just fixes everything without mistake, because it can be 100% sure where blocks end.


 No.897470>>897472

>>897467

I trust my own editor up to a point, but I don't trust other people's editors.


 No.897472>>897473

>>897470

And that's their problem.


 No.897473>>897479

>>897472

No, because most code I read wasn't written by me.


 No.897479>>897480

>>897473

Are you reading on those people's editor?


 No.897480>>897483

>>897475

>>897479

I usually read it in my own editor, which doesn't modify code unless I edit it.

I sometimes use something that isn't an editor at all, like a pager in my terminal or a web page.


 No.897483>>897488

>>897480

How hard is to format on your own editor before reading it? You seem like those infomercial people.


 No.897485

>>896628

>I am confident that hordes of masters at coding are spending all their time verifying every bit of other people's code.

The sad convictions of open source fanboys..


 No.897488>>897489

>>897483

It can be very hard when I'm not using my own editor in the first place. Or an unreasonable amount of work, anyway. Sometimes I'm viewing a repository I haven't cloned, or the output of grep -rC 20 or similar.

But even if I am using my own editor it doesn't play nicely with version control to change half the lines in a file.


 No.897489>>897491

>>897488

In which case you don't need that kind of certain and your argument is moot.

What does it matter to understand 100% code you are not actively working on?


 No.897491>>897493

>>897489

If I am actively working on code then version control is involved.

If I'm reading the code in the first place then I care about understanding the code, and understanding it properly is better than not understanding it properly.


 No.897493>>897495 >>897497 >>897564

>>897491

THEN FUCKING FORMAT IT BEFORE READING MY GOD STOP MAKING OBSTACLES FOR YOURSELF AND USING A RETARDED LANGUAGE THAT EVERYONE ELSE AGREES IS RETARDED BECAUSE OF YOUR SELF-IMPOSED AUTISM


 No.897495>>897498

>>897493

That takes extra work. A lot of extra work if I'm not using an editor in the first place. And it messes up version control.

Why do you want a language to make you do menial bullshit like reformat all code before reading it? Are you some sort of masochist?


 No.897497>>897498

>>897493

>MY GOD STOP MAKING OBSTACLES FOR YOURSELF AND USING A RETARDED LANGUAGE THAT EVERYONE ELSE AGREES IS RETARDED BECAUSE OF YOUR SELF-IMPOSED AUTISM

t. someone who unironically uses javascript

hmmmmmmmmmmmmmmmmmmmmmmm...


 No.897498>>897501 >>897506 >>897564

>>897495

Its just a simple command on the editor, don't bullshit me, and you can always undo it before committing. Which in itself raises another question: why isn't there a standard when it comes to formatting in the project?

>>897497

Javascript doesn't do anything you can't find on other popular languages, unlike significant white space.


 No.897501>>897502

>>897498

>Javascript doesn't do anything you can't find on other popular languages

javascript does a whole lot of bullshit that other popular languages don't do. significant whitespace isn't really a problem.


 No.897502>>897503 >>897564

>>897501

>javascript does a whole lot of bullshit that other popular languages don't do

Such as?


 No.897503>>897504

>>897502

literally the OP: >>896410 (OP)


 No.897504>>897505 >>897506

>>897503

What are you talking about? Lots of languages use type coercion.


 No.897505

>>897504

Lol. Please rewrite the example in the OP in another language.


 No.897506

>>897498

>Its just a simple command on the editor, don't bullshit me, and you can always undo it before committing.

Like I said, sometimes I don't use a text editor to read the code.

Having to juggle reformatting just to get a clean diff is annoying. Is it really easy to undo it if you've made other changes? What kind of workflow do you have in mind? Unreformatting before every change, then reformatting again so you can keep reading?

>Which in itself raises another question: why isn't there a standard when it comes to formatting in the project?

Maybe the project was written by incompetent people. Maybe it was written by written by people without a good text editor. Maybe the project is just garbage. Sometimes you have to read garbage code.

>>897498

Javascript implicitly inserts semicolons at line endings if and only if it would prevent a syntax error. That's awful, and no other languages that do it in quite that way come to mind.

>>897504

Type coercion doesn't mix well with using + for both concatenation and addition.


 No.897516>>897521 >>897580

File (hide): f3a7c7962629ca3⋯.png (79.62 KB, 1178x498, 589:249, julia.png) (h) (u)

Javascript btfo


 No.897521>>897524 >>897532

>>897516

>muh math


 No.897524>>897534

>>897521

Math as a basis for programming is totally retarded. The + operating should be used to print to the screen. No reason it should add numbers.


 No.897532

>>897521

>programming languages have nothing to do with math


 No.897534

>>897524

*operation


 No.897542>>897544 >>897560 >>897586

>>897438

I do not want to pretend a big fat object with a bunch of attributes and methods isn't being created every time I use an integer in python.


 No.897544

>>897542

I know this is besides the point, but it isn't, usually. Integer objects between -5 and 256 are interned, so they are reused.


 No.897553

>>897361

Go back to writing monkeypatch addons, Lynx.

>Performance, to begin with.

Negligible for many kinds of applications and there're multiple libraries for number crunching.

>Then you have asinine syntax.

nod an argumend

>And don't forget unreadable significant whitespace.

nod an argumend


 No.897554

>>897395

>write C program with 1 space indent

<LOL @ UR LANGUAGE NEEDING EDITOR TOOL

Get mugged by a huenigger, Lynx.


 No.897560>>897564 >>897582

>>897542

That's not what is meant there, though.


 No.897564>>897569

>>897457

Get glasses, Lynx. If you can see how many levels deep you are using indentation in your Huescript app, you can see how many levels deep you are in Python as well.

>>897467

>No because your editor just fixes everything without mistake, because it can be 100% sure where blocks end.

<Imagine a language where you need the editor to help you

Go see a doctor about your goldfish memory, Lynx.

>>897493

Take your meds, Lynx.

>>897498

>Its just a simple command on the editor

Stop it and get some help, Lynx. +1-800-273-8255

He's explicitly stating that he's not using an editor when he's using a pager or git diff. Is this so hard to understand? How dense are you?

>>897502

Oh fuck off, Lynx. You know JS' shortcomings as well as any Starbucks nigger. Don't feign ignorance.

>>897560

Press F to use a noose, shamo.


 No.897569

>>897564

>Press F to use a noose, shamo.

no u


 No.897580

>>897516

>"This string variable asterisk the other string variable gives..."

>"This string variable plus the other string variable gives..."

I prefer the latter.


 No.897582>>897585

>>897560

It's your post, you're responsible for making it comprehensible.


 No.897585>>897586

>>897582

Well, what part did you not understand?


 No.897586>>897590 >>897681

>>897585

What "pure Object-Oriented" means. I managed to sort of get the idea from context (and I didn't make >>897542), but it's not an established term with a single commonly known meaning.

In Python, everything is an object. Functions, modules, classes, integers, you name it. By some reasonable definitions that makes it purely object-oriented.


 No.897590>>897591 >>897660 >>898667

>>897586

Internally, everything in Python might be an object, however, conceptually, this is not the case. When you program, you can feed Python a list of instructions and C-style functions and it will work painlessly. This is in contrast with Java and (iirc because I've used it very little) C#, in which there exists nothing outside of classes. All functions, constants, definitions ever belong to a class.

The same goes for C++: while it does have classes, you're not forced to use them. Things exist outside of classes.


 No.897591>>897594

>>897590

>he doesn't know about sizeof in C#


 No.897594

>>897591

No, I don't know of sizeof in C#, but I doubt it really invalidates what I say.


 No.897660

>>897590

Everything in Python being an object is more than just some internal detail. Modules are objects, and that means you can subclass the module type, add a method to implement looping, and set the type of a module to that so you can now loop through the module object. You can do all kinds of crazy things. They're objects at a deep level.

(the rest of your post makes sense)


 No.897681>>897688 >>897692

>>897586

>In Python, everything is an object

this is why python is 1000 times slower than everything else.


 No.897688>>897692

File (hide): eb896b8904137a2⋯.jpg (25.02 KB, 640x360, 16:9, DamEil7VAAE2wgU.jpg) (h) (u)

>>897681

Pythonfags cant admit this and show you benchmarks where the only thing the python does is call a c library.


 No.897692>>898478

>>897681

>>897688

I love Python.

If what you're doing is intensive enough that the speed of the language is important, and you can't move the bottleneck into C, don't use Python.

Many tasks aren't computationally intensive, and Python is good at moving things into C. So Python is still a very useful programming language.


 No.898478>>898479

>>897692

Exactly. Python is literally just a wrapper for C/Asm libraries at this point.

Ruby is trying to be abstracted C, when things can be abstracted further.

JS/PHP are only prioritized for the web elite, but is uncomfortable to use.

Perl is dead, because Perl 6 didn't deliver when Python 3 exists.


 No.898479

>>898478

I still use Perl 5 for everything scripting related, and I have no plans to change. I'll probably leave the Unix platform entirely before Perl 5 ceases to be maintained.


 No.898667

>>897438

Pure OO means everything is an object. Methods and classes are objects. There's a class of classes, which is an object because it's a class. Smalltalk, Common Lisp, Python, and Ruby do it this way. You should not blame OOP for why Java and C# suck unless it really is an OOP flaw (and not just single inheritance, primitive types, C syntax, and other Java flaws).

Java also sucks because there's so much bullshit that programming classes will have to spend more time on Java, which means they will be teaching fewer languages. This is also a reason why C, JavaScript, and UNIX suck. Learning more programming languages (and not just UNIX languages) will give you a better idea of why something sucks. They got this way because their creators didn't care.

>>897590

>C-style functions

Python doesn't accept C-style functions.

>>> from __future__ import braces
File "<stdin>", line 1
SyntaxError: not a chance

I'm TA'ing an OS course this semester.  The last lecture was
an intro to Unix since all other operating systems were only
imperfect and premature attempts to create Unix anyway.
Some lecture highlights...

An aside during a discussion of uid's and many a unix
weenie's obsession with them: "A lot of people in the Unix
world are weird."

When asked if Ritchie et al regretted some other
inconsistency in Unix metaphysics, "These guys probably
don't care."

Have another twinkie.


 No.898668>>898670 >>898671

>>896445

That's what js was designed for.

Retarded, yes, but it's doing its thing well.


 No.898670

>>898668

That particular date thing isn't being done well. If "10" - "5" is 5, and 10 + 5 is 15, then "10" + "5" should be 15. Making it otherwise is dangerously misleading.

That's why so many weakly typed languages have a different operator for concatenation and addition.


 No.898671>>898672

>>898668

web pages should just fail to render at the smallest error everything would be so much cleaner and clearer


 No.898672>>898674

>>898671

Realistically, most websites would be broken in some browsers (and not the same browsers, it would be different for each website) and you'd be refreshing constantly to restart crashed pages.


 No.898674>>898679

>>898672

Realistically the developers would have had to write compliant code just like literally every other programming language.


 No.898679>>898699 >>898704

>>898674

They'd have to, but they wouldn't.

Javascript code needs to be compatible with many independent interpreters, which is unusual to begin with, but it's also written by web developers, who are often at the low end of the experience hierarchy.

If you've got someone writing Java then there's an implicit minimum requirement of being able to pass through the compiler. You can't deploy the software without running it through all the compilers it has to be run through. It only has to work with a single compiler and version to work.

But Javascript needs to be compatible with many different interpreters and many different versions. It's all too easy to deploy Javascript that will be incompatible with some of them, because it worked on my machine™ is not nearly as strong a guarantee.


 No.898699>>898708

>>898679

c/c++ has 4 different main compilers that all work together. intel, gnu gcc, apple llvm, microsofts whatever the fuck they use.

the fact that there are multiple implementations is no excuse


 No.898704

>>898679

javascript actually is not backwards compatible. neither is html. they introduce features all the time that don't work at all in old browsers. and your code just fails to work without clear errors.


 No.898708

>>898699

If I write C code that's only going to be seen by me then it's fine if it only compiles under GCC. I only need to compile it with GCC.

If I write javascript that's only going to be used on my own website then it's not fine if it only works in my own browser. It needs to be interpreted over and over again.


 No.898725>>898729

If Javascript had to be backwards compatible with all browsers ever, it would NEVER mature or progress as a language and would in all likelihood degenerate into a bloated mess like Java did.


 No.898729

>>898725

I should also point out that HTML and CSS suffer from the same problems, and infact the single biggest culprit of browser compatibility problems isn't Javascript or HTML, but CSS. If you think interpretation of Javascript was bad, wait until you look into interpretation of supposedly static rules like CSS where shit like transform(-50px) makes something go up in one browser and down in another browser.




[Return][Go to top][Catalog][Screencap][Nerve Center][Cancer][Update] ( Scroll to new posts) ( Auto) 5
221 replies | 15 images | Page ?
[Post a Reply]
[ / / / / / / / / / / / / / ] [ dir / arepa / bestemma / kc / lolnada / orbg / soyboys / tisminc / vg ][ watchlist ]