[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vr / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / asp / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / qst / sci / soc / sp / tg / toy / trv / tv / vp / wsg / wsr / x] [Settings] [Home]
Board
Settings Home
/g/ - Technology



Thread archived.
You cannot reply anymore.



File: teach_me_cpp_senpai.jpg (155 KB, 1440x810)
155 KB
155 KB JPG
No language holy wars edition.

Previous Thread: >>63309860

What are you working on /g/?
>>
File: 1456271270443.gif (91 KB, 634x400)
91 KB
91 KB GIF
>>63316107
Is it true? What am I missing?
>>
>>63316135
>teach_me_cpp_senpai.
learncpp.com
>>
>>63316158
Is this a decent or should I go with a book
>>
>>63316172
That's the most modern C++ resource I found online
>>
Fuck sepples. Use C.
>>
Why is it that if I do:
${var: -1}
using
sh script.sh
, it gives me shit, but not when I use
./script.sh
?
>>
>>63316135
Where do I learn the theory and on how to master the most important Scheme constructs such as continuations or define-syntax or force, delay?
>>
File: buildinsider_wallpaper2.png (184 KB, 2048x1280)
184 KB
184 KB PNG
Programming on a tablet.
>>
>>63316135
Last night i had a dream where i was programming a new OS on my laptop at school (during a break).
I had TempelOS running in a VM for some reason, but i did all my programming
in vim (or some vim-like editor). All was going well, but then some of my
classmates showed up and asked wtf i was doing and was i using LINUX.
The time around me stopped when i heard the word LINUX. image of RMS
flashed in my mind and i heard the words of the Holy Interjection echoing in my ears.
Then i had autistic meltdown, and i yelled: "IT'S CALLED GNU + LINUX".
Then i told that i am programming a new OS in GNU Forth. (https://www.gnu.org/software/gforth/)

After this i woke up.

So /dpt/, how do i learn to program (hobbyist) OS?
>>
Is there something like visual studio for html and javascript?
I used to do them i notepad++ but after tasting the godlike combination which is visual studio and c#, going back to notepad++ was like going back to eating rancid shit after eating delicious cakes for years
>>
>>63316226
nigga why
>>
should I learn bash?
I'm still learning C and i'm a noob
but I have basic proficiency using linux (intermediate cli usage)
>>
>>63316243
>should I learn bash?
ye
>>
>>63316203
Fuck C. Use Rust.
>>
>>63316233
You just need to create a kernel, or adapt the minix one like linus did, and then slap gnu tools on top of it and there you go, an OS
>>
>>63316243
>should I learn bash?
It's decently useful to know, especially for automating some shit you might do, but it fucking sucks for writing anything complicated.
>>
>>63316217
> What is bash?
>>
File: steve.jpg (19 KB, 300x300)
19 KB
19 KB JPG
>>63316255
>rust
>>
>>63316274
Based Rust.
>>
>>63316217
${var: -1} is a bashism, and your /bin/sh probably doesn't support it.
I would guess that you're using Debian/Ubuntu, and your /bin/sh is dash.
>>
>>63316270
yeah I know I think it's the next step after you learn basic cli shit and what a shell is
I'm gonna start with this guide
http://www.tldp.org/LDP/Bash-Beginners-Guide/html/intro_02.html

should I read the man bash before or after?
>>
File: 1510391408670.jpg (52 KB, 720x960)
52 KB
52 KB JPG
>lol
>>
I'm pretty excited. Next week we're going to be starting the process for open sourcing the three different tools I've made for Kafka/Elasticsearch automation & monitoring.
>>
>>63316306
Nice!
>>
>>63316229
That's the sepples philosophy. If it's broke, add another feature to fix it.
>>
>>63316303
Clearly fake.
Are you stupid?
>>
I'm learning C and I can't seem to find an open source project that I could grasp entirely

any suggestions?
How and when did you start contributing to open source projects?
>>
>>63316269
what are good resources about kernels/os design?
i already got Modern Operating Systems 2nd ed. and Operating Systems: Design and Implementation 3rd ed.
>>
>>63316203
>>63316255
>>63316274
>>63316279
Did you guys even read the OP?
>No language holy wars edition.
You have to wait until the next thread to start a language holy war.
>>
Is there a way in Rust to constrain access to resource to a single thread so that calling any methods on it from a different thread would panic?
>>
>>63316349
Most "real" open source projects are large and complicated, and can take weeks, or even months for someone to get familiar with; even experienced programmers.
Don't expect to be making large changes to anything. Start with trivial shit, and over time you will become more familiar with the code (also, the other developers will trust you more), and then you can start working towards more substantial changes.
>>
>>63316149
>Is it true? What am I missing?
It isn't. There's a fuckton of older hardware or even just shitty recent hardware that doesn't support Vulkan. Browsers don't support it. Most mobile devices don't support it. If you want anything remotely close-platform that can run on non-gaming PCs, stick to OpenGL.
>>
>>63316303
not legal
>>
>>63316357
>editions in /dpt/
This thread should have been deleted already, dumb fuck.
>>
>>63316380
Use this?
https://doc.rust-lang.org/std/thread/struct.ThreadId.html
>>
File: 1496114727751.jpg (33 KB, 400x562)
33 KB
33 KB JPG
>>63316357
There are no 'editions', fuckface.
In fact, there should be no extraneous text in the OP at all. It's not your personal shitposting space.
>>
>>63316402
ok thanks for the tip
>>
>>63316413
>https://doc.rust-lang.org/std/thread/struct.ThreadId.html
That would be part of the solution, I guess, but what I really need is some kind of a proxy object that does the check automatically before calling a method on the proxied resource. I really don't want to have to manually add this check to every call.
>>
Which utility library to use with C: glib, tbox, qlibc, klib, apr or something else?
Also thread pool or coroutine library like qthreads?
>>
>>63316203
I get the intention is to make fun of how Americans can't speak, but why not call it sepplespples?
>>
>>63316431
It helps if the project's issue tracker has anything marked as 'easy', but not everybody does that.
Also, if the project has an IRC channel or something, it would be in your best interest to join it.
>>
>>63316434
to every method*
>>
>>63316440
qthreads are cancer compared to the standard library alternatives.
>>
>>63316440
Utility (bloat) libraries are completely unnecessary, especially trash like glib.
I refuse to use glib (or any dependency that pulls it in) in any of my programs.
>>
>>63316380
Haven't though about this too hard, but how about wrapping the resource in an opaque struct and performing the thread id check inside an Deref impl?

I'm think the auto-deref on method calls would call your custom implementation. I may be quite off with this idea, don't really do too much complex rust shenanigans.
>>
>>63316476
>wrapping the resource in an opaque struct and performing the thread id check inside an Deref impl
Sounds like a good idea, actually. Thanks, anon.
>>
>>63316440
Use Libtask for coroutines.
https://github.com/jamwt/libtask
>>
>>63316528
https://swtch.com/libtask/
>>
>>63316236
Just use the console and debugger built into browsers like Firefox or Chrome?
>>
I always liken programming books to secret martial arts manuals.
>>
>>63316543
That is for debugging not developing, what are you even doing in this thread you fucking normie?
>>
>>63316528
>>63316537
>Libtask gives the programmer the illusion of threads, but the operating system sees only a single kernel thread.
no
>>
>>63316551
>secret martial arts """manuals"""
Something that a typical virgin programmer would say
>>
>>63316566
>he uses notepad to code
>"what are you even doing in this thread you fucking normie?"
Kek
>>
>>63316520
Just tested this out with an example. Works as I initially thought. Here it is if it is of help:

struct UniqueThread {
id: usize
}

impl UniqueThread {
fn is_same_thread(&self) -> bool {
self.id == 0
}

fn func1(&self) -> u32 {
0
}

fn func2(&self) -> u32 {
3
}
}

struct UniqueThreadWrapper(UniqueThread);

impl ::std::ops::Deref for UniqueThreadWrapper {
type Target = UniqueThread;

fn deref(&self) -> &Self::Target {
if !self.0.is_same_thread() {
panic!("this wasn't the same thread!");
} else {
println!("checking thread before use!");
&self.0
}
}
}

fn main() {
let a = UniqueThreadWrapper(UniqueThread { id: 0 });

assert_eq!(a.func1(), 0);
assert_eq!(a.func2(), 3);

let b = UniqueThreadWrapper(UniqueThread {id: 1 });
assert_eq!(b.func1(), 0);
}


Get the expected output:

checking thread before use!
checking thread before use!
thread 'main' panicked at 'this wasn't the same thread!', src/main.rs:26:12
note: Run with `RUST_BACKTRACE=1` for a backtrace.
>>
Give me your best FizzBuzz /dpt/
>>
>>63316663

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#define Oo 100ULL
#define __(oo,oO)\
for (o=(Oo*(oo)>>(oO));o<=Oo;o+=(Oo*(oo)>>(oO)))OO ++[O]

int _o(const void *o, const void *O) { return
((*(uint64_t*)o) >> 48) > (uint64_t)(*((char*)O + 6)) ;}

int main(void)
{
uint64_t oo, oO, o, O [Oo * 0x1bbbbbbbd4 >> 36], OO = 0;

__(0x3e0f83e1ull, 35) = (o << 060) | 2054842694;
__(0xcccccccdull, 36) = 0x7a7a7542 | (o << 48);
__(0xa57eb503ull, 38) = (uint64_t)0xff << 36 | (o << 0x30)
| ((o + 0x30 - 10 * (o * 205 >> 11)) << 010)
| (((0x1999999a * o >> 32) + 0x30)); qsort(

O, OO, sizeof(0[O]), _o);
for (o =0;o <OO;o ++) {
oO= o[O] >> 060; oo =o;
while (!(oO^ (o [O]>>48)) && (o [O]&16711680))
printf("%s", (char*)&o ++[O]);
printf(!(o ^oo) ? "%s\n" : "\n", (char*)&o [O]);
} return

0;
}
>>
File: fiz.jpg (24 KB, 675x702)
24 KB
24 KB JPG
>>63316674
Something's not quite right here
>>
>>63316236
Lots of text editors have plugins to add support for stuff like that. But you could try atom or vs code if you're lazy. They're more bloated than text editors but they should have good support for html and js by default.
>>
>>63316707
dummy, of course you aren't using the right platform! what do you think I write, portable c?
>>
>>63316638
I don't get how you rustfags can stand that ugly syntax.
>>
>>63316713
>bloat
that word means nothing to me, after trimming the visual studio 17 install down to only required components the install size was 22GB.
Literally any other editor no matter how bloated will seem super slim to me.
>>
File: 1503237831496.jpg (138 KB, 1356x1017)
138 KB
138 KB JPG
Just found out that Computer Science doesn't count as engineering, so I'm not actually graduating as engineer
>>
so far my script can reverse or crack
>binary
>hexdecimal
>ROT
>base64
>md5
>sha1
>sha256
>sha512

what else should I add?
>>
>>63316972
AES-256
>>
>>63316972
What year are you from exactly and when did the leap to quantum computing occur? Does Trump actually manage to build a wall?
>>
>>63317013
will do
>>63317093
uses wordlists
>>
>>63316663
const fizzBuzz = (function(){
const _Fizz = "Fizz";
const _Buzz = "Buzz";
const _FizzBuzz = _Fizz + _Buzz;
return function fizzBuzz(limit = 100) {
for (let i = 1; i <= limit; ++i) {
switch(i % 15) {
case 0:
console.log(_FizzBuzz);
break;
case 3:
case 6:
case 9:
case 12:
console.log(_Fizz);
break;
case 5:
case 10:
console.log(_Buzz);
break;
case 1:
case 2:
case 4:
case 7:
case 8:
case 11:
case 13:
case 14:
console.log(i);
break;
}
}
}
}());
>>
Anyone knows a good CS MOOC? I tried CS50x but using Scratch is not really what I wanted.. I wanted something like C or Python.
>>
File: racketlog.png (142 KB, 512x512)
142 KB
142 KB PNG
>>63317201
https://www.edx.org/micromasters/software-development
>>
>>63316135
what is the name of this anime pls ?
>>
>>63317291
thanks
>>
>>63317162

But does it store the results to speed up later searches?
>>
Whats a way to only do something if the string is an exact match in python? currently using if "x" in choice but that doesn't need and exact match only 1 match
>>
going to make a text editor that i plan to use while programming
>>
>>63317510
"abc" == "abc"
>>
>>63317307
bitch lasagna
>>
>>63316303
>senior dev
>mysql
kek
>>
>>63316972
>crack sha256/512
You can literally be a millionaire right now
>>
>>63317660
>>63317660
see >>63317162
>>
>>63316303
>Head of HR
>50 dollarydoos/hour

Even if it wasn't fake, they would have run themselves into the ground before a court date could be set.
>>
>>63317660
he thinks using a reverse table is cracking. the guy never heard about salted hashes and it does say a lot about his skills.
>>
>>63316570
Please consult google with green threads/fibers/userland threads vs kernel threads
>>
>>63316728
What terminal?
>>63316663
>nobody made one with sprintf and digit sum checks
>>
File: ayy.jpg (32 KB, 540x960)
32 KB
32 KB JPG
reminder that go programmers are intellectual dwarves
>>
>>63317738
>picking on an easy target
>>
>>63317752
It's your civil duty to stamp out any attempt of adopting go.
>>
>>63317769
Go is better than its alternatives.
>>
I have to choose my own topic for my databases course project
gimme some neat ideas of databases nothing too big or tough though ;3
>>
>>63317714
it attempts using salt after going through the wordlist once
>>
>>63317773
go fuck yourself
>>
Gitlab, bitbucket or github? or something else?
>>
>>63317783
make a torrent indexer
>>
Learning an ALGOL derivative as a first language causes brain damage.
>>
>>63317803
i use gitlab but I'm not a serious developer
>>
>>63317787

Haha you just started a new thread fucking yourself
>>
>>63317827
what made you choose it?
>>
>>63317813
I learned fucking JSP as my first language, followed by C++. Can confirm, learning scala and haskell made me very intimate with my own brain-damage
>>
>>63317831
github doesn't offer free private repositories and bitbucket didn't have the word git in its name
>>
>>63316135
I wrote a script in Ruby to show me that i'm losing my pants in the bitcoin crash

Then I wanted to prove to myself that I could use a Big Boy™ language if I had to. You know, a language with strong typing. So I decided to learn Java.

2 days later, I had managed to reproduce the script in Java


I don't know what to do now. Need an idea for another project. (or I could finish one of the other projects I've started; I've got like a dozen projects on standby)

I don't know if I want to continue with the comfy languages (nodejs, ruby, php, etc), or if I want to continue with Java. I hate java. I hate it to death. But Java jobs pay quite well, and I really, really like money.

There's also C/C++ which are on my to-do list of languages to learn. Then there's rust, which seems complicated as all fuck. (I read the guide; they want you to do memory management and all that) However, rust is an up and coming language, so investing myself in it now could yield great payoff later.

I don't know guys, what do you think? Which one of you bastards is rich? How did you get your fortunes?
>>
>>63317902
Rust is not like any of the languages you mentioned. It's a difficult challenge indeed.
>>
>fork C# project off github
>open code
holy shit this region autism
>>
>>63317932
Happened to me so much as well. Can't remember if there was a VS setting to disable regions altogether or at least expand them all by default.
>>
>>63317902
You should definitely learn C at some point. It'll improve your understanding of how imperative programming and low level data structures actually work.

C++ is a huge, huge pile of shit sat on top of C. To the point where it's a totally different language. There's a lot of useful shit in there, but it's confused and half baked, and fails to meet the potential.

Rust is kind of a of fresh air after C++. The RAII idiom, useful in C++, is now a core part of the language and enforced by the compiler for the sake of memory safety. This means it's quite hard to handle. However, the other primitives (traits, enums, pattern matching) are all far more ergonomic than equivalents in C++ so it's quite pleasant to use when you're not fighting the borrow checker.
>>
>>63316638
Thanks, anon. Come to think of it, is there any way to mark a type as not shareable/movable across threads for the static checker? What does Rc do to achieve this? I would very much like to prevent objects that contain OpenGL handles from leaking to threads with a different GL context in the first place.
>>
>>63317956
That fucking borrow checker scares me.

I'm getting pretty strong in high level object oriented languages. At least, I think I am. I know the fundamentals.

But I have never done any multi-threaded programming before, and I've never done any memory management. I'm used to the interpreter taking care of everything for me.

Rust is still an OO language, right?
I don't entirely understand the borrow system, I need to re-read that bit if I decide to learn rust. But can you still make custom objects and store the data within the objects and be able to reliably count on being able to retrieve that data later?

In other words:
Do I have to worry about data in my objects being trashed, just because I've changed scope or something?

I understand closures, and they're insanely useful. But from what I think I understand, rust just sort of trashes things once you step outside of the closure. They're not infinitely retrievable like in JS.

In js, it seems like you can always access any variable whenever you like. It doesn't matter if that function stopped executing an hour ago. If you have any reference to any object that was within that closure, you can still pull shit back out of that closure indefinitely.

Is rust going to break my world?

I'm not good with all of this computer science stuff, because I didn't go to school. I've learned to write code the hard way.
>>
File: Cvkk8PSWIAAmdOF.jpg (43 KB, 702x836)
43 KB
43 KB JPG
>post yfw there are more traps than actual females into programming
>>
What's a secure algorithm to generate session tokens?
>>
>>63318044
>Rust is still an OO language, right?
No
>>
Free git hosting

https://github.com/
https://notabug.org/
https://bitbucket.org/
https://gitgud.io/
https://gitla.in/
https://gitlab.com/
https://git.zxq.co/
https://git.teknik.io/

some may be dead now. always have multiple mirrors.
>>
>>63318044
>Rust is still an OO language, right?
There's no inheritance, so...
I guess you can do OO in Rust just as you can do OO in C, it just won't really be "idiomatic Rust".
>>
>>63318044
Rust doesn't have OO.
It has structs, which are a predefined bundle of named types, like structs in C.
struct Person {
name : String,
age : i32
}

It has traits, which are a lot like interfaces (particularly in Go).
You can implement a trait for an existing type, like a struct. Then you can pass a trait type somewhere or use a type implementing a trait in a generic. It's not quite OOP, but once you get the hang of it you'll love it.

Borrow checking and lifetimes will make a lot more sense if you understand C++ RAII and move semantics. Since Rust lacks a garbage collector, the borrow checker is needed to determine whether a variable exists and when the compiler is allowed to delete it. In C and C++ this is accomplished by the programmer explicitly or semi-explicitly discarding data that will no longer be needed.

I recommend learning C to begin with. It's a minimal and small language. Then think about C++ or Rust.
>>
>>63318105
was for >>63317803
alba clark
>>
>>63318129
Don't forget the ADTs
>>
>>63318093
Seriously?

Then why bother learning it?

I'm not going to go 30 years back in progress, by learning a non-OO language. (except maybe C, because it is historical and is a fundamental)

Why would anyone invent a new language that is not OO?

If it is not OO, then it is worthless. I'm not going back to the days of needing a million variables, and a million functions with exceeding long names just because I gotta try to half-ass mimic OO in a procedural language. I don't even know if I still remember how to program in a non OO language. Even my bash skills are starting to get rusty because its just so hard to work with a non OO language.
>>
>>63318145
Those are particularly comfy, especially for data structures.
But like I said, the BC forces you to write it in a way that might be inelegant or suboptimal.
>>
>>63318156
Is this bait
>>
>>63318156
>OO is the only paradigm
awful
>>
>>63318156
S T A T I C
T
A
T
I
C
>>
>>63318107
>>63318129
Oh. Well that sounds like OO.

I'm not talking super-formal, has-to-meet-the-official-definition OO.

I'm talking:
Can I structure my data in the form of an object? (associative arrays are fine; hashes/dictionaries are also fine)

As long as you can create something like an object... as long as you have the ability to group related bits of data in a key-value store, then I consider it to be OO.
>>
>>63318156
OO isn't what you think it is. You should really read some CS books, the concept of OOP is somewhat obsolete as newer (post 2010) languages avoid your idea of OOP (like (multiple) inheritance, aggregation, polymorphism, circular dependencies and class-member encapsulation etc).
>>
>>63318156
Rust has elements of OO (traits are interfaces but way better) and elements of FP (variant types and pattern matching).
That's a common trend more generally, especially along "modern" OO languages.
Regardless, Rust isn't simply procedural. Polymorphism is encouraged and quite flexible.
>>
>>63318156
>I'm not going back to the days of needing a million variables, and a million functions with exceeding long names just because I gotta try to half-ass mimic OO in a procedural language.
What makes people think this is necessary?
>>
>>63318156
Daily reminder that OOP is 50 years old by now.
>>
>>63318216
lack of scoping / closures means everything is global namespace, so you have to make sure your variable/function names aren't going to conflict

Not being able to make object-specific functions (methods) further grossifies everything by, again, requiring your functions to be in global namespace
>>
>>63318192
You can group named and typed attributes in a struct. The struct's attributes are fixed at declaration.
For polymorphism, you have traits. You can implement all the methods for a trait for any type, and then pass that into a function or whatever.
There's no inheritance or prototypes.
>>
>>63318238
>lack of scoping / closures means everything is global namespace,
What does closures have to do anything with it? Rust has closures. Now

>lack of scoping means everything is global namespace,
Wrong.
let x = rectangle::new(12,44);
let y = triangle::new(11, 90);
let z= parabola::new(65, 23);
I don't see what the problem is.


>Not being able to make object-specific functions (methods) further grossifies everything
Huh?
x.draw();
Rectangle::draw(x);
y.draw();
Triangle::draw(y);
>>
File: Nope.png (4 KB, 639x478)
4 KB
4 KB PNG
I'm trying my hand at a simple raytracer in Java.
A regular rectangle/cube in front of the camera views fine, but as soon as I start rotating and moving the camera the cube/rectangle gets warped.
Any idea what causes this?
Pic related is a cube
>>
>>63318271
You need to give more information than that buddy.
>>
I'm reading the second edition of the Rust Book. It's pretty good, especially compared to the first edition.
Rust looks like a good alternative to C++ and Java. The only thing I dislike is how it handles modules.
>>
Wanna start working on ai, should i learn python? I have read some things that python and ai goes along
>>
>>63318129
>Borrow checking and lifetimes will make a lot more sense if you understand C++ RAII and move semantics. Since Rust lacks a garbage collector, the borrow checker is needed to determine whether a variable exists and when the compiler is allowed to delete it. In C and C++ this is accomplished by the programmer explicitly or semi-explicitly discarding data that will no longer be needed.

How do Rust programmers not even know their own language? This is completely wrong.
>>
>>63318351
He's not wrong though
>>
Today's challenge:
Implement e^x without floats, using only integer arithmetic and bitwise ops. Rounding errors are permitted, as long as they do not affect the result within the accuracy of the used return type.
>>
>>63318398
no
>>
>>63318086
srand(getpid ^ getppid ^ time(NULL) ^ clock());
optionally add /dev/urandom to the mix, or replace rand() with xorshiro instead of lcprng
>>
>>63318398
>e
>without using floats
Okay man

return std::pow(3,x);
>>
>>63318398
auto ex (...)
{
//TODO: Implement
}
>>
How do I display images in a separate window using go? I tried reading the docs but I still don’t get it.
>>
File: 1508747959630.png (35 KB, 408x450)
35 KB
35 KB PNG
>reference counting is garbage collection
>>
>>63318463
It's actualy worse
>>
Guys, I'm just a student but I know my code is messy, shitty and not optimized. The struggle at the moment for me is to just get it working, it's not like I'm bashing my head against the desk trying to get stuff to work but it's enough that It's stopping me from making writing actual good, "professional" code a priority.

Is this a big problem, is improving just a matter of practicepracticepractice? I feel like the fact that I have actually acknowledged this as an issue is a good start, considering that the attitude of my peers seem to just be "fuck it it werks lmaoo".

pls no bully I just don't want to be mediocre.
>>
>>63318398
extern float exptable[];

float exp(float x) {
uint32_t i = *(uint32_t)&x;
return exptable[i];
}
>>
>>63318463
référence counting is an implementation technique for garbage collection but not only.
>>
>>63318398
Thats just dumb
>>
>>63318483
It will come with time. Start some code base. When you'll come back to it later you'll realize you don't understand wtf is going on and this will help you figure out what you need to do in order to make it better. So yeah it's mostly experience. You can learn to code in a week. You can't learn to make good, maintainable codebases in less than a few years.
>>
>>63318483
It'll improve with practice.

Also, with better planning.
>>
Teacher said that static methods are a bad practice in OOP. True? Why?
>>
>>63318532
tell him classes can be objects too and a static method is a method of the class, not of the described object and if he can not understand this level of meta programming then he probably should leave the field.
>>
>>63318483
Plan -> Write -> Test -> Optimize -> Release
You skipped the first step and now your code is all twisted together. Before writing code, visualize how each 'module' interacts with other 'modules'. If it doesn't make sense, start over.
>>
>>63318532
They aren't as flexbile because they aren't overridable and can't be substituted easily.
Use singletons instead.
>>
>>63318554
Class methods and static methods are different things.
>>
>>63318577
only in poorly designed programming languages.
>>
>>63316236
Dreamweaver?
>>
top kek. i was watching stranger things and that guy suddenly crafted a script in BASIC. wtf? don't they know dat shit is hated and has been deprecated 40 years ago
>>
>>63316236
VS Code
>>
>>63318410
>>63318442
>>63318445
>>63318489
>>63318503
>being this much of a shitter
>>
>>63318398
Today's reminder that knowing how to do this won't get you a job.

Instead, learn web dev
>>
File: nocs.png (53 KB, 605x353)
53 KB
53 KB PNG
>>63318686
sure kid
>>
>>63318701
How can anyone fail a problem as trivial as this
>>
>>63317920
not a big fan of rust but i gotta say this is quite nice
>>
>>63318809
because of
>>63318686
>Instead, learn web dev
fiat diodorea
>>
>>63318809
I don't even know what binary tree is, anon.
>>
>>63316236
IntelliJ Webstorm

Paid but if you still have a student email - any student email - you can get a liscense that will last a year.
>>
>>63318809
I know right? Even if you have no idea what you're doing you can extrapolate from the name what a binary tree is and what reversing it would look like.
>>
>>63318701
flip the whiteboard 180 and you're done
>>
>>63318483
If you can't get things done, YOURSELF, at a student level, you need to drop out.

So sick of dealing with idiots entering the workforce that only know how to copy and paste.

The "just werks" mentallity is cancer.
>>
Is there something like this in matlab that wouldn't involve writing it with for loops.
>>
>>63318483
when working on something just split it into smaller task and do these one by one until they work and test as you go
>>
>>63318657
I think the show takes place in the 80's. The script he wrote was this
10 DIM FourDigitPassword INTEGER
20 FOR i = 0 TO 9
30 FOR j = 0 TO 9
40 FOR k = 0 TO 9
50 FOR l = 0 TO 9
60 FourDigitPassword = getFourDigits (i,j,k,l)
70 IF checkPasswordMatch(FourDigitPassword) = TRUE THEN
80 GOTO 140
90 END
100 NEXT l
110 NEXT k
120 NEXT j
130 NEXT i
140 PRINT FourDigitPassword
150 END
>>
>>63318848
It doesn't say reverse though, it says invert.
But if it's only that, then isn't the solution as simple as this?
invert(tree)
case Empty : return Empty
case Node(left, right) : return Node(invert(left), invert(right))
>>
>>63318938
oh fug I got to transpose left and right
>>
>>63318884
>The "just werks" mentallity is cancer.
This is the mentality of the average programmer in 2017. Consulting documentation isn't cool anymore, but copy/pasting from StackOverflow is. Don't think for yourself, others have already done that.
>>
>tfw no modern language combining the features of BASIC, Perl, Algol, and x86 asm
(mostly based on BASIC)
>>
Does anyone has a pdf of this?
>>
>>63318994
libgen.io
>>
>>63318156
If you dig deeply, the only reason you feel the need for OOP is the want for polymorphism.

Simple as that.

Everyone wants it, and some find it in OOP+generics, others in dynamically-typed and/or scripting languages, others in purely functional programming, Gophers in interface{}s, C-niles in Macros ..

"Non-OOP" doesn't mean going back to Pascal or some such.
>>
>>63319052
>C-niles in Macros
Cfags use function pointers and void pointers for polymorphism. Macros are for ghetto metaprogramming.
>>
Writing an encrypted chat app using Go and Ncurses.
>>
Why do "self-thought" programmers feel so entitled?
I went to uni and I still had to self-teach myself for most of the course. Uni is there just to direct and exam your skills but if you 100% rely on lectures you become useless.
>>
>>63318916
Holy shit that callback hell
>>
>>63319115
i love making """""coding bootcampers""""" mad
>>
>>63319115
>Why do "self-thought" programmers feel so entitled?
[citation needed]
>>
>>63318457
The standard library doesn't cover anything related to "windows". Find your favourite GUI toolkit bindings lib for Go that you can get to work at your end. Or find your favourite OpenGL&SDL|GLFW bindings libs for Go that you can get to work at your end, which let you open a window and draw anything in there (no GUI APIs in there though, drawing only)
>>
>>63318826
>>63318826
Each node in the tree has 2 (bi-nary) nodes linked to it. Basically in Go pseudocode:
type BinTreeNode struct {
Left: *BinTreeNode
Right: *BinTreeNode
MuhCustomData: interface{}
}
>>
>>63319130
> calling goto hell callback hell
> so 2017
>>
>>63319240
> MuhCustomData: interface{}
>interface{}
So this is the power of Google...
>>
>>63319267
at least interface{} knows its type
void* is sin
>>
>>63318999
>libgen.io
It's not on there, at least if you do author search for Conery
>>
>>63319115
>Why do "self-thought" programmers feel so entitled?
>self-thought
Why do self-taught spellers feel entitled to comment on self-taught programmers?

>Uni is there just to direct and exam your skills but if you 100% rely on lectures you become useless.
I guess that's why most university students come out useless as programmers.
>>
func main(argc int, argv ptr) int {
for i := 0; i < argc; i++ {
puts(argv[i])
}

var f flt = 1.1
text := flt_to_str(f)
puts(text)

return 0
}


Rate my update to C :)
>>
>>63319282
C is 45 years old.
>>
File: 1361575922167.jpg (385 KB, 1600x1200)
385 KB
385 KB JPG
>>63316443
>why not call it sepplespples?
C++ => "See plus plus" => Sepples.
Although I do understand that the point you're making; that the second "plus" syllable is absent in the corrupted pronunciation; although, at that point, you might as well go for something more akin to, say, "Sepubles" or "C Bubbles".
>>
>>63319304
>older than my mom
damn
>>
>>63319267
Same as object in C#/Java in this instance (the "empty interface" case). Yeah with generics it would be BinTreeNode<T> with MuhCustomData: T, but no biggie man.
>>
>>63316203
>>63319307
>>63316443
It's an old /prog/ meme. Please don't use it except on hallowed ground.
>>
File: 1460619977782.jpg (59 KB, 390x470)
59 KB
59 KB JPG
>>63319130
>he can't read BASIC
>his mind can't handle ONE (1) GOTO
>>
>>63319115
>I had to spend 40,000 minimum in order to be directed to the internet
>becoming a good developer
Pick one
For every one thing you learned in your computer science courses, there are at least 5 things that they haven't taught you
>>
>>63319329
>generics
>but no biggie man
>>>/g/wdg/
>>
if a static_assert involving reinterpret_cast doesn't throw an error, then it will be ok on all machines that run the compiled code? it will be the same byte order etc?
>>
dc is Touring complete
>>
What are you personally doing to encourage more female representation in CS, /g/?
>>
>>63319351
>spend 40,000 minimum
>Pick one

I pick the fact that I'm not Amerifat, thank you.
>>
>>63319366
nvm it doesn't seem to allow it in the first place. fuck
>>
>>63319366
No, endianness matters. In general, all that shit is implementation defined. Also, I'm not sure what the aliasing rules are regarding reinterpret_cast - maybe you want to use a union instead?
>>
>>63319369
shitposting on /g/
>>
>>63319369
molesting
>>
>>63319369
Converting healthy young males in to filthy degenerate crossdressers.
>>
>>63319369
nothing at all, if they want to, they will apply
>>
>try to implement something
>it all goes to hell
>give up
>repeat
>>
>>63319369
Hacking into their windows PCs and spreading their nudes around campus.
>>
>>63319388
i would like to use a bitfield but i would also like to construct it efficiently with a constant partial bitfield and bitwise OR of the non-constant part. do i have to use a uint32_t and "manually" mask off bits or should i look into unions or something?
>>
>>63319371
Well you're still getting cucked by paying for Ahmed to go to class to learn how to date white women
>>
>>63319424
I hope Asian people dilute the white gene pool and produce glorious asian/haffu babies, finally joining the two master races together for world domination
>>
>>63319424
Burger King logic
>>
Why hasn't anyone used DHT for decentralized streaming? Flood to nearest n neighbors, only transmit a key, then they look up the key in the DHT. As everyone does it at the same time, it takes full advantage of the aching
Your thoughts?
>>
>>63319505
for what purpose
>>
>>63319550
For example, you can stream video, instead of having to cache it like bittorrent. Bittorrent can stream video, but it has to rely on a central server (then we can just do hls with magnet links) or have the video pre-generated (e.g. popcorn time, sequential downloading)
It would also be useful for pubsub type applications.
>>
>>63319505
ipfs?
>>
>>63319601
IPFS just floods randomly, and is implemented in a shitty language. Although they could use this solution for pubsub, yes.
>>
>>63319623
IPFS is a specification. The reference implementation is written in Go, but that doesn't stop you from writing it in Haskell.
>>
>>63318675
You read some trick to do e^x without floating point operations, wow you are like god holy fuckk.
>>
>>63319291
Can't find it either.
Well, fuck. It seems like an interesting book.
>>
>>63318398
long exp(long x) {
return 1 + x + x * x / 2 + x * x * x / 6;
}

What do I win?
>>
>>63319691
1 + x + x^2/2 + x^3/6?
Why would this help? Isn't this for solving quadratic equations?
>>
>>63319369
female CS students
>>
>>63319801
https://en.wikipedia.org/wiki/Power_series#Examples
>>
/// <summary>
/// Get Integer Value.
/// </summary>
/// <param name="obj">Object type obj</param>
/// <returns></returns>
public int GetIntegerValue(object obj)
{
return GetIntegerValue(obj, 0);
}
public int GetIntegerValue(object obj, int defaultReturnValue)
{
try
{
if (obj != null && obj.ToString().Length > 0)
{
string objvalue = ClearSpecialChar(Convert.ToString(obj));
defaultReturnValue = Convert.ToInt32(objvalue);
}
//else
//{
// defaultReturnValue = Convert.ToInt32(obj);
//}
}
catch
{

}
return defaultReturnValue;
}
>>
>>63319297
Google recruiter here. Please send us your CV and prepare for a whiteboard interview on binary trees.
>>
>>63319801
It's a power series. Haven't you taken calculus? You can prove that series like that exist for all analytic functions with Cauchy's Integral formula. Come on anon.
>>
If Google hires the best programmers, why do they use shitty languages?
>>
>>63319801
https://en.wikipedia.org/wiki/Taylor_series#Exponential_function
>>
If you believe Google uses shitty languages, it means you're not good enough for Google.
>>
>>63319961
they do not hire the best programmers for most of their stuff
majority of their programmers are fresh graduates/interns that do mundane work
>>
>>63319993
But they say they only hire the best

And there was that shitty resistor question purporting to be from their interviews a few years back
>>
>>63319961
Most Google programmers are brainlets. That's why Go is so popular at Google.
>>
>>63319992
I'm quite happy not being good enough to think that go isn't a shitty language
>>
>>63316236
atom. it even comes with electron
>>
>atom
Remember when we thought emacs was bloated? How innocent and naive we were back then.
>>
File: Script.png (58 KB, 507x586)
58 KB
58 KB PNG
Does anyone know how to modify Atom so that a particular keyword/phrase has the correct syntax formatting? I downloaded a plugin for a scripting language I'm using and one of the keywords isn't highlighted for some reason. I already tested the script and it was working correctly so I got the syntax right. *fake_choice should be highlighted in the same way as *choice. I'm on linux mint if that matters. I'm new to using Atom and I'm not sure how to define stuff like this in the config files (I assume that's how I'm supposed to do this.)
>>
>>63316135
A neat shell script that allows me to click on a window and record it with ffmpeg. It has options to record audio, record with window decorations or without them and you can specify a file size to automatically export the recorded file to webm ready for 4chan upload.
It works now.
>>
>>63320153
1. uninstall atom
2. install emacs
>>
>>63320153
Gee I dunno how about you grep for the other keywords to get the location and then add the other keyword there?
>>
>>63320189
How hard would it be to create my own scriping syntax rules in emacs? This language doesn't seem very complicated but I've also never done something like that before.

>>63320208
What?
>>
File: 600508_f83e_4.jpg (75 KB, 750x422)
75 KB
75 KB JPG
hi matrlab /g/uru here
>>
>>63320228
>What?
open the fucking folder with the syntax definitions
search for "choice"
add "fake_choice" next to it
??
>>
>>63320228
You'd have to use emacs lisp. There's a free book here: https://www.gnu.org/software/emacs/manual/eintr.html
>>
>>63316416
>It's not your personal shitposting space.
disagree
>>
>>63319987
But that misses the x^4 terms and above.
>>
>>63320243
Oh sweet, I found it and it worked, thanks.

>>63320245
I think I'll stick with Atom for now unless there's a particular reason to switch to emacs. I'me a pleb and don't type very fast so text editors that are built around quick touch typing navigation are kind of wasted on me. I have tried them before, like I went though the entire vim tutorial that comes with the man file.
>>
>>63320308
retard
>>
>>63320308
For sufficiently small x x^4/24 is below your precision, so who cares?
>>
>>63320319
Try Sublime.
>>
>>63320319
Fair enough. Just remember that emacs will still be there if your typing improves to a point that you find atom sluggish!
>>
>born too late to experience the 80s and the golden age of computer science
>born too late to experience the 90s and the golden age of malware
>born too late to experience the early 00s and the golden age of file sharing and darknets
>born just in time to compete with Pajeet for writing "blockchain technology" and "internet of things"
It won't get any better, will it?
>>
>>63320339
Max value of input before overflow is log(LONG_MAX)/log(e) = 22. 22^4/4 ≥ 1.
>>
>>63320352
No, but you can always learn Scheme
>>
>>63320386
>22^4/4
You mean 4!. Anyway if you really care that much, just use 9 terms instead of 3.
>>
>>63316203
Fuck nipples. Use Pee.
>>
>>63320423
Fuck Knuckles. Use chuckles.
>>
>>63320433
I'd rather flex my muscles.
>>
>>63320352
What is that 'blockchain technology'? I've heard it before, but I get the feeling it's some kind of marketing buzzword.
>>
>>63320454
This is all you need to know: https://www.xe.com/currencycharts/?from=XBT&to=USD&view=5Y
>>
>>63320481
I know what crypto currency is, but how is it related to programming?
>>
>>63320500
I don't know. Maybe blockchains are generated by computers or something?
>>
>>63320454
Pure buzzword.
>>63320500
Not at all in that context.
>>
>>63320500
lol
>>
>>63320500
Memecoins are a meme, for now at least
Blockchains though are interesting because it's a decentralised cryptographically verified shared linked list data structure that could be applied in many areas like electronic voting
There are many things to discover still like formal verification of algorithms and implementation, faster implementation, collision resolution, etc
Academic types love blockchains
>>
>>63320230
I'm sorry for you.
>>
>>63320591
That's the answer I was looking for. Those shitty coins are a complete joke. Blockchains sound interesting though.
>>
>>63320153
Step 1. figure out the name of that whack lang you're trying to use
Step 2. figure out the author/repo of the Atom plugin/extension/language-definition-file for language-found-in-Step-1
Step 3. send them the screenshot and ask what might be up

Why would "Mint" matter? What did you expect to find in Atom's "config files", a setting "enabled_correct_syntax_highlighting" defaulting to false?

You know what to do, and as always.. "think"!
>>
>>63320717
>>63320153
and most likely those authors will reply that "choice" is a keyword but "fake_choice" isn't, in that language --- not sure tho since I've never seen it and don't know it.
>>
File: benis.png (341 KB, 407x417)
341 KB
341 KB PNG
>>63316929
in my country the default course is a mix of cs and engineering and gives you the title of engineer
>>
I tried writing a game in Rust.
You think of a thing, then the program asks you what it is using a sequence of questions. When it reaches the leaf of the tree, it tells you what it thinks the thing is. If it's incorrect, then it asks you to insert a new question so it can distinguish between the item you chose and the item it thought it was. It tracks this knowledge with the following tree.
enum Tree {
Answer {
text : String
},
Question {
text : String,
yes : Box<Tree>,
no : Box<Tree>
}
}


I have a function which plays the game using a recursive method. It accepts a Tree as its argument, and returns a (possibly-updated) Tree.

fn play(tree : Tree) -> Tree {
match tree {
Tree::Answer{ text } => {
// Omitted
}

Tree::Question{ text, yes, no } => {
println!("{}", text);
match get_y_or_n() {
true => Tree::Question {
text,
yes : Box::new(play(*yes)),
no
},

false => Tree::Question {
text,
yes,
no : Box::new(play(*no))
}
}
}
}
}

This part leaves me dissatisfied. One of the boxes is moved, from, causing it to deallocate its contained storage. Then Box::new is called, triggering another allocation. Is there some way to rewrite this without an unnecessary alloc and dealloc? Is the compiler smart enough to optimize this away?

The whole code is here. Feel free to criticize that too.
https://codeshare.io/2E6XQK
>>
>>63320747
Rust can't even implement a linked list satisfyingly, what makes you think it can handle trees?
>>
File: 181111.png (20 KB, 346x336)
20 KB
20 KB PNG
Why does pic execute both if and else ?
>>
>>63320810
if {
...
}

...

if {
...
}
else
{
...
}

these two bits are unrelated
>>
>>63320810
You forgot an else after the first bloc. It should be else if
>>
>>63320788
>Rust can't even implement a linked list
>C doesn't have strings
>C++ can't split strings
What other hot memes are popular these days?
>>
>>63320843
That a language without dependent types can be useful, and that a language with dependent types cannot be useful.
>>
>>63320870
Added to the meme list. Got anything else?
>>
>>63320890
That not having generics is better than having generics.
>>
>>63320843
The art of the strawman.
>>
>>63320899
*tips fedora*
>>
File: file.png (724 KB, 1200x790)
724 KB
724 KB PNG
>>63320897
>>
>>63320843
>C does not have strings
This is true. It only supports a character array. Char arrays are NOT strings
Best implementation of strings I've ever saw was unironically php. If only it wasn't so shit
>>
>>63320996
What makes PHP strings so good?
>>
>>63321005
A good library that supports it
Hell, I can calculate the levenshtein distance of two strings with arbitrary costs with one function call. And that's just one example out of hundreds of powerful string functions
>>
What is a good tips for code golfing?
for example how small this C's Hello world could be? And how it done?
#include<stdio.h>
int main()
{
printf("Hello World\n");
return 0;
}
>>
>>63318884
did you even read my post?
>>
>>63321094
>undefined behavior
lad...
>>
>>63320747
I think std::mem::replace is the way to go when you need to avoid deinitializing boxes. I remember that from the howto on linked lists.

https://doc.rust-lang.org/std/mem/fn.replace.html
>>
>>63320996
>This is true
this is false
>>
So is Python usually the go-to language if I want to get into programming and have little to no previous knowledge?
>>
guyse, is there a way to get class's name in a macro within saild class?

i want readonly attribute and it works too, as demonstrated on pic related.

but god fucking shit, that's unreadable. if only i didn't have to type the class's name.

maybe there is another way to do this?

i'm fucking exausted writing shitty fucking getters. i'm done.

if you're retarded i'm talking about c++, not c# or some shit.
>>
What's better for wagecucking C# or Java?
>>
>>63321222
C# + ASP.NET
>>
>>63321139
???????
>>
>>63321191
thinking emoji
>>
>>63321222
Java because it's open source now and you won't feel filthy when you are writing, because it's being actively taught in universities so there are many books on algorithms on java and you won't feel completely like a wage slave, because the jvm is nice and there are very nice other languages running there like clojure which interface nicely with java and because despite all the memes java is a nice language and the verbosity doesn't bother you when you get a nice free ide and it actually makes sense
>>
>>63321222
java
>>
File: 1318833616011.jpg (110 KB, 800x800)
110 KB
110 KB JPG
>>63321298
what the fuck are you even talking about you shitstain. is this a suggestion? is this a lib? is this yet another meeme made by newfags? speak like a fucking person.
>>
>>63321334
you're being unclear about what you actually want to do
>>
>>63321191
>but god fucking shit, that's unreadable
yeah so explain your problem better
>>
File: 🤔.gif (1.93 MB, 460x259)
1.93 MB
1.93 MB GIF
>>63321334
:thinking: emoji
>>
>>63321404
>so I don't know
apparently you don't know C
>>
>>63321191
>readonly that also does friend C so that any struct containing readonly can directly modify it
i think you should first rethink whatever youre trying to achieve lmao
>>
File: Shame Cube.gif (2.51 MB, 320x227)
2.51 MB
2.51 MB GIF
>>63321094
>>63321421
Yeah, I buggered up the code.
Also, I don't know the functions for lower level string printing.
#include <stdio.h>
main(){puts("Hello world!");}
>>
File: output.jpg (5 KB, 662x159)
5 KB
5 KB JPG
>>63316135
function fib(n:int):int
{
if(n <= 1) return 1;
return fib(n-1) + fib(n-2);
}

function fibletter(n:int):String
{
var ret:String = "";
for(var i = 0; i < n; i++) {
var k:int = fib(i);
var count:int = 0;
while(count < k) { ret += " "; count++; }
var istr:Array = i.toString().split("");
for(var j:int = 0; j < istr.length; j++) {
switch(istr[j]) {
case "0": ret+="o"; break;
case "1": ret+="n"; break;
case "2": ret+="v"; break;
case "3": ret+="c"; break;
case "4": ret+="t"; break;
case "5": ret+="b"; break;
case "6": ret+="y"; break;
case "7": ret+="q"; break;
case "8": ret+="m"; break;
case "9": ret+="w"; break;
default: throw "Unrecognized number exception thrown at input: [" + istr[j] + "]";
}
} ret+="\n";
}
return ret;
}

trace(fibletter(20));


:^)
>>
>>63318963
>BASIC
the only reason I don't hate basic its because I learned QBasic when I was 10yo.
>>
i don't know anymore
>>
>>63321094
Sorry. I had text along with my example.

Never done code golfing, so I don't know; however, I do know that you can omit the int: functions without type declaration are automatically assumed to be ints.
Furthermore, the
return 0;
can also be left off: functions, that reach their end without coming across a return statement, just "fall off the edge".

So you can write that as >>63321486, although no doubt it can be written smaller.
>>
>>63321306
But I what if I want redmond to cuck me
>>
File: 1333746740027.jpg (131 KB, 491x735)
131 KB
131 KB JPG
>>63321342
>>63321370
i want to have

readonly(string) s;

declaration with macros or whatever, that will automatically know that i want to make class which it is decladed in, its friend.

like what i already posted but without explicitly writing class name every sigle fucking time.
>>
File: '.jpg (5 KB, 512x160)
5 KB
5 KB JPG
function fib(n:int):int { return (n <= 1) ? 1 : fib(n-1) + fib(n-2); }
function fibletter(n:int):String
{ var ret:String = "";
for(var i = 0; i < n; i++) {
var k:int = fib(i), count:int = 0;
while(count < k) { ret += " "; count++; }
var istr:Array = k.toString().split("");
for(var j:int = 0; j < istr.length; j++) {
switch(istr[j]) { case "0": ret+="o"; break;
case "1": ret+="n"; break; case "2": ret+="v"; break; case "3": ret+="c"; break;
case "4": ret+="t"; break; case "5": ret+="b"; break; case "6": ret+="y"; break;
case "7": ret+="q"; break; case "8": ret+="m"; break; case "9": ret+="w"; break;
default: throw "Unrecognized number exception thrown at input: [" + istr[j] +"]";
}
} ret+="\n";
} return ret;
} trace(fibletter(30));


ActionScript is literally the best language in existance
>>
>>63321653
use alias templates? not sure if that's what you want since you can't properly express yourself
>>
>>63321334
>>63321653
good posts
>>
why does GitHub display double quote like this?
>>
>>> a = 1
>>> a
1
>>> print(type(a))
<class 'int'>
>>> a = str(a)
>>> a
'1'
>>> print(type(a))
<class 'str'>
>>>


Could anyone explain (or give a link to) to me, how this magic of object type (or "Class") conversion in python works?
>>
>>63321509
Is that... TypeScript?
>>
I have a program that works with UDP over IPv4. I wanted to try porting it to IPv6. Now everything builds but I realized afterwards that my ISP didn't provide me with an IPv6 address so I'm kind of fucked. I would like to prevent the program from starting in this case but the only ways to check for IPv6 support are kernel level and that always returns true since Linux supports IPv6 since 2.2. Any advice?
>>
>>63321876
That's how it highlights syntax errors
>>
>>63321761
that's even more code spaghetti declarations.
>>
>>63321968
>macros are better

im laughing
>>
>>63321897
https://wiki.python.org/moin/Why%20is%20Python%20a%20dynamic%20language%20and%20also%20a%20strongly%20typed%20language
>>
>>63321976
>templates
>not macros
>>
>>63321982
Thanks, but I need "how", not "why", like which built-ins are invoked, what is the magic.
Inb4 read the source.
>>
>>63322020
>I need
no you dont
>>
>>63321919
You can iterate over interfaces and check what addresses are assigned, and exit if there are no IPv6 addresses (not counting link-local addresses).

I just bind to both v4 and v6, and let it use whatever is available.
>>
>>63322020
rtfm
>>
imna writer a browser with scheme support and pretend that javascript never happened

that'll be my world
>>
>>63322031
Yes, I do, cause I am writing custom Classes and I want to know how to convert the shit from one to another.
I HAVE TO KNOW!
>>
>>63322020
There is no magic. Read SICP.
>>
>>63322041
wtf, I don't like reading, you nerd
I like coding
>>
>>63320591
They are hardly new though. Git was released in 2005, and likely wasn't the first.
>>63320843
Rust can not implement xor-double linked lists.
>>63320996
How are char arrays not strings?
>>63321058
There are external libraries.
>>
>>63322064
Then go ask Kloss
>>
File: 1396953257626.jpg (575 KB, 2112x2071)
575 KB
575 KB JPG
>>63321976
if i could have something like
#define READONLY(v) readonly<__PARENT_CLASS__, v>


that's just one declaration for this attribute that i can now use everywhere and that could be easily comprehended by whomever reads my spaghetti.

you, on the other hand, are suggesting to have a typedef and for every. single. fucking. class a member of which i want to use as readonly in some other class.
>>
>>63322068
>Rust can not implement xor-double linked lists
Rust has unsafe pointer types, and integral types to match them.
Is it really impossible?
>>
>>63322050
>>63322041
>>63322031
Thanks, 4chan, kys, my senpaitachi.
>>
>>63322050
There's no magic type conversion there. You declared two different variables, but the second one happened to have the same name as the first, so it replaced it in the current scope.
>>
>>63322090
what even is this readonly thing? some microshart extension?
>>
>>63322107
I'm not gonna spoonfeed something that is literally in the docs for builtins.
>>
>>63322043
I've been thinking about that for a while too. And with an s-expression based markup language.
>>
>>63321897
>>63322050
class Whatever:
def __init__(self, x):
if type(x) == int:
print("Converting from int")
elif type(x) == str:
print("Converting from str")
else:
print("Can't convert")

a = Whatever(1)
b = Whatever("one")
c = Whatever([True, False])


I didn't even bother running this
>>
>>63322153
And how does it inherit attributes?
>>
>>63322098
It's impossible because Rust isn't a bare-metal type language, you still need C to be able to work with memory directly,
>>
>>63321897
str(x) calls x.__str__, or if that doesn't exist x.__repr__
>>
>>63322179
Uh no. Rust supports arbitrary pointer arithmetic in its unsafe blocks.
>>
>>63322175
What the fuck does that mean? It's not inheriting either jack or shit, is this your first language or what?
>>
New thread:
>>63322221
>>63322221
>>63322221
>>
>>63322179
Not an argument. Rust has pointers, Rust has corresponding ints, Rust has a XOR operator and Rust can disable borrow checking. What element is missing to implement xorlists?
>>
>>63321897
str(someshit) allocates a str and then calls its __init__ with someshit as an argument. This __init__ happens to know how to stringify an int and it does so. No magic involved. If your class has a __init__ it can take arbitrary arguments and do whatever to them.

You also have __new__ if you need to do more involved shit.




Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.