Having a project/goal is a good way to learn a new language. I am wanting to do the same with Go
@StephenHall-zz2ym
3 ай бұрын
I've been learning go with bubbletea and been loving it.
@vei_bean
2 ай бұрын
I have to point out that chat is wrong about how signed numbers work in binary. ALSO some rust things you might wanna know They are correct that the most significant bit is the signed bit, they are wrong in how it works. For an example, let's assume chat is correct, and I'll use 8 bits because I'm lazy, chat says -1 would be represented as 10000001 But that has a few issues for one 10000000 would be -0 which isn't real and a waste of space, it would also mean a (software) overflow of a signed integer would result in -0. If you know anything about overflows you should know that in reality you actually get the minimum possible value, for 8 bits that would be -128. There are other issues with chats idea such as having to swap add and sub operations based on if the number is negative or not which also requires the CPU to be aware of whether you are using signed numbers, on a CPU more logic means more space which is something we want to avoid. In reality, computers, in addition to using the most significant bit as the signed bit, also give it a numerical value i.e. 10000000 would be -128 instead of -0 and 10000001 would be -127 instead of -1, -1 is actual 11111111 (this means -1 + 1 is a (real) overflow that results in 0). The benefits of this approach are a slightly larger range as -0 doesn't take up a possible value, the logic for add/sub is the same for negative and positive integers and the CPU doesn't need any knowledge of if a value is signed or not (which means less logic and less space). Also, I mentioned real and software overflows, the difference is very simple. A software overflow is not a real overflow, but the software still considers it an overflow because the software knows something the hardware doesn't, that being that the number is signed. 127 + 1 on a signed 8-bit number is a software overflow as it goes from 01111111 to 1000000 the binary doesn't wrap around, but the software knows that it did because the software knows it's signed. On the other hand -1 + 1 is a real overflow as it goes from 11111111 to 00000000 you can see that the binary wrapped around this time, of course the latter case won't be considered overflowed by the software because the number was signed but if it was unsigned software would say it's an overflow. Also also, The saturating methods will not overflow, but clamp at the maximum or minimum value. Think of a tuple as an unnamed type with unnamed fields instead of an array, as that is literally what it is. () unit/empty tuple IS void, they use it instead of void because it's not a special type like void would have to be, after compilation they are represented the same i.e. not existing
@Lado93
3 ай бұрын
Rust is difficult first especially borrow checker. Just don't try do a double linked list in it lol Rc
@StephenHall-zz2ym
3 ай бұрын
me like
@JasonTudisco
2 ай бұрын
Just use GO already. Your going to save hours. Lol.
@nittani.
3 ай бұрын
Wow 5 comments chris you fell off bro jk jk can u teach me rust too
Пікірлер: 10