Mr SuperAwesome posted:i looked up that SO post and what the actual gently caress right, you tell me. i understand the code (more or less), but all i got out of it and similar posts this evening is an interest in studying mypy docs for a bit to see how it differs/supplements type hints
|
|
# ? Oct 14, 2017 18:57 |
|
|
# ? Jun 8, 2024 23:28 |
looks like ive been using mypy all along, since it is just a ~more flexible~ version of static analyser built in pycharm, which references the same typing and hints things that i do what im saying is that i have no loving idea the gently caress i am doing, as usual
|
|
# ? Oct 14, 2017 19:12 |
|
Yeah pycharm alrady does that stuff. Mypy is theoretically useful if you want type checking in vs code or whatever, although in practice it's pretty frustrating and you should probably just decide if you want to use python or a statically typed language.
|
# ? Oct 14, 2017 19:22 |
mystes posted:Yeah pycharm alrady does that stuff. Mypy is theoretically useful if you want type checking in vs code or whatever, although in practice it's pretty frustrating and you should probably just decide if you want to use python or a statically typed language. imo its a decent way to document code and catch some glaringly stupid stuff
|
|
# ? Oct 14, 2017 19:35 |
|
MyPy is good, but the type hints should be (at least optionally) runtime checked and asserted on.
|
# ? Oct 14, 2017 19:54 |
|
okay i figured out why my jaguar thingy works in the emulator but not a real console the LOAD instruction in the GPU requires long-aligned data. the emulator doesn't take this into account. the compiler, a 68k compiler, is word-aligning my sprite metadata. on the real device it bugs out because of this and reads bad data from RAM. there's no alignment attribute in my compiler... and I can't switch to GCC without the proper 68k jaguar libc headers for GCC. welp. shot an email off to the guy who writes VBCC, see if he can do anything about that. he fixed the last few bugs I found when doing Jag stuff. all mallocs are long-aligned so I could work around it by copying the sprite data from ROM to RAM but I’d rather not. Luigi Thirty fucked around with this message at 21:41 on Oct 14, 2017 |
# ? Oct 14, 2017 21:38 |
|
mystes posted:Yeah pycharm alrady does that stuff. Mypy is theoretically useful if you want type checking in vs code or whatever, although in practice it's pretty frustrating and you should probably just decide if you want to use python or a statically typed language.
|
# ? Oct 14, 2017 21:47 |
|
Luigi Thirty posted:okay i figured out why my jaguar thingy works in the emulator but not a real console hack the linker luigi
|
# ? Oct 14, 2017 22:11 |
|
can you just put a pointer before your sprite metadata or something? like literally before might work if the compiler spits globals out in order, which it totally might
|
# ? Oct 14, 2017 22:23 |
|
very few languages bother directly supporting explicit-range integers. in c++ it's not hard to write a template to do that, though, and that'll even store it with an optimally-compact type
|
# ? Oct 14, 2017 22:27 |
|
rjmccall posted:can you just put a pointer before your sprite metadata or something? It does not. the metadata structs are 24 bytes long so another solution would be to just put them in their own long-aligned section in the linker.
|
# ? Oct 14, 2017 23:25 |
|
it turns out i'm a dumbass and the sprite data itself is aligned properly. the pointer to the sprite data wasn't long aligned... in the node struct I wrote. i added 2 bytes of padding and now i have 50 sprites bouncing around on my TV again. took 2 days to figure that out
|
# ? Oct 15, 2017 01:49 |
|
you're not dumb, you're just doing programmingtoiletbrush posted:Swift is good because when I feel clever using it, it's because I've been super pedantic about everything and so if it builds it will probably work. if this is true for you I assume this swift code you speak of is not calling into UIKit
|
# ? Oct 15, 2017 02:02 |
|
mystes posted:If you don't need this to actually be part of the type system and just want some sort of overkill way to effectively do assertions, Eiffel. i wish more dynamically typed languages would adopt refinement types.
|
# ? Oct 15, 2017 02:09 |
|
npm sucks and 5.3+ are annoyingly broken because they rushed feature parity with yarn
|
# ? Oct 15, 2017 02:19 |
|
5.2- is annoyingly broken because it's npm
|
# ? Oct 15, 2017 02:34 |
|
true, something after 5.2 breaks though and the only given solution is to downgrade or delete node_modules and your lockfile every time lol
|
# ? Oct 15, 2017 02:45 |
|
i just scripted some file renaming i used java
|
# ? Oct 15, 2017 03:04 |
|
Master Stur posted:true, something after 5.2 breaks though and the only given solution is to downgrade or delete node_modules and your lockfile every time lol the solution is to use yarn
|
# ? Oct 15, 2017 03:18 |
rjmccall posted:very few languages bother directly supporting explicit-range integers. in c++ it's not hard to write a template to do that, though, and that'll even store it with an optimally-compact type Could you expand on this?
|
|
# ? Oct 15, 2017 03:29 |
|
carry on then posted:i just scripted some file renaming did you check it in
|
# ? Oct 15, 2017 03:50 |
|
pokeyman posted:did you check it in well, the results, yes
|
# ? Oct 15, 2017 03:51 |
|
VikingofRock posted:Could you expand on this? sure, an explicitly-bounded integer is something like “10..20” as a type, the idea being that you should just state your requirements and the language will figure out how to implement them efficiently on the hardware. it was a much bigger thing in older languages, and it does seem to make some sense at first, but it actually has a lot of problems the more you think about it. like if you have a statment like x=x+y, what type is the addition performed in? the most natural answer is to say that it’s done in infinite precision and then the result is coerced to the type of x, but that pretty quickly scales in complexity for the implementation, which has to do heroic optimizations to try to avoid every addition turning into an allocation. or you pick some arbitrary type, but now the choice of that type is extremely important for the semantics of the program and the whole thing doesn’t seem so elegant anymore. c did a lot to convince language designers that programmers mostly didn’t care and it wasn’t worth introducing all that complexity trying to hide that kind of machine detail from the programmer, because the important cases of fixed-range integers were mostly cases where people actually just wanted a symbolic enum or did you mean about how to do it in c++ rjmccall fucked around with this message at 04:16 on Oct 15, 2017 |
# ? Oct 15, 2017 04:13 |
|
Mr SuperAwesome posted:i looked up that SO post and what the actual gently caress that SO post posted:Bear typing is dramatically more efficient in both space and time than all existing implementations of type checking in Python to the best of my limited domain knowledge. (More on that later.) mmmmods!??
|
# ? Oct 15, 2017 05:32 |
rjmccall posted:or did you mean about how to do it in c++ Yes--I guess I should have been more specific. But I appreciated the post anyways!
|
|
# ? Oct 15, 2017 06:02 |
|
VikingofRock posted:Yes--I guess I should have been more specific. But I appreciated the post anyways! i just like talking about the language design stuff in c++ it's just something like C++ code:
|
# ? Oct 15, 2017 06:56 |
|
i do occasionally miss bounded integers from PL/X, but they were only implemented efficiently thanks to hardware support for BCD. even then we usually ended up having to switch to bit-lengths when someone wanted more transactions per second
|
# ? Oct 15, 2017 09:27 |
rjmccall posted:sure, an explicitly-bounded integer is something like “10..20” as a type, the idea being that you should just state your requirements and the language will figure out how to implement them efficiently on the hardware. it was a much bigger thing in older languages, and it does seem to make some sense at first, but it actually has a lot of problems the more you think about it. like if you have a statment like x=x+y, what type is the addition performed in? the most natural answer is to say that it’s done in infinite precision and then the result is coerced to the type of x, but that pretty quickly scales in complexity for the implementation, which has to do heroic optimizations to try to avoid every addition turning into an allocation. or you pick some arbitrary type, but now the choice of that type is extremely important for the semantics of the program and the whole thing doesn’t seem so elegant anymore. c did a lot to convince language designers that programmers mostly didn’t care and it wasn’t worth introducing all that complexity trying to hide that kind of machine detail from the programmer, because the important cases of fixed-range integers were mostly cases where people actually just wanted a symbolic enum that would do it for me, since something as simple as range limiter would only be good for multiple choice input arguments imo. and now that im checking, python did actually add enums in 3.4 that's a whole load of refactoring that i can do, and the syntax isn't the worst, by that meaning code:
code:
|
|
# ? Oct 15, 2017 09:36 |
|
rjmccall posted:very few languages bother directly supporting explicit-range integers. in c++ it's not hard to write a template to do that, though, and that'll even store it with an optimally-compact type I am actually giving my students something similar as an optional assignment this semester Going to be fixed size only (int I guess?), and won't support modulo (because lol at deriving new bounds for modulo given two weird rear end ranges with possibly negative values). The jury is still out on division, mostly I think I will just specify rounding behaviour and disallow division by ranges that include 0.
|
# ? Oct 15, 2017 09:59 |
rjmccall posted:i just like talking about the language design stuff This is very cool. Thanks!
|
|
# ? Oct 15, 2017 10:15 |
|
terrible programmer question: what are the differences between smalltalk-style message passing oop, and java/c#-style oop? what does smalltalk do that java doesn't?
|
# ? Oct 15, 2017 10:33 |
|
cinci zoo sniper posted:im using type annotations with python 3.6, it is completely unrelated to what i am asking, which is which languages have a specific mechanism of enforcing types and values of objects Common Lisp and CLOS let you work with constrained types Lisp is generally a strongly typed language, just not explicitly typed; you can’t reinterpret bits in memory without jumping through a bunch of hoops (strong typing), but you don’t have to declare every variable or function’s type (explicit typing) and you can have variables and functions either be open ended in type or constrained (dynamic by default, static possible) it doesn’t look like C at all but it can do type constraints and modern compilers will use them to good effect, too, both to warn or error on code that violates them and to do optimized code generation that can be competitive with C the infix syntax for Dylan was an attempt to basically make a cleaned up CLOS with Pascal-style syntax for type declarations specifically to make it more attractive to programmers used to Pascal and C
|
# ? Oct 15, 2017 11:13 |
|
hackbunny posted:pascal was my first too and it was good, but it belongs in the past real-world Pascal is barely any different than C when you look at their semantics, their syntax is just superficially distinct they’re like VB.Net and C# in that way
|
# ? Oct 15, 2017 11:14 |
|
redleader posted:terrible programmer question: what are the differences between smalltalk-style message passing oop, and java/c#-style oop? what does smalltalk do that java doesn't? in Smalltalk literally everything is an object and everything is a message send (aka dynamic dispatch), both (what other languages treat as) primitives and classes are also true objects so when you written x := 3 + 4. it’s sending + to the instance 3 of class Integer with the instance 4 of class Integer as an argument, and the method that handles that message can do what it wants including introspect the context in which the message was sent practically speaking you also have really aggressive optimization so if the compiler and runtime can prove there’s no dynamic behavior that will be invoked, it can generate more aggressive code—but back that out of later on, dynamic behavior is needed (for example because you added a subclass of Integer) in Java instance messages like foo.doSomething(bar, baz) work like this, down to the back-out-optimizations behavior (which came from Sun hiring the Smalltalk developers who created Self & Strongtalk, and having them create Hotspot) but there are also primitive types that don’t have methods and also there’s no such thing as dynamic dispatch to a class so you can’t override a class method in a subclass and have the override called despite syntactically derived from C++, Java was semantically modeled on Objective-C, which makes the same kind of object vs primitive split but kept classes as objects and class methods from Smalltalk, as well as the keyword-style syntax for OO stuff Smalltalk also doesn’t dispatch messages to methods based on all argument types, it dispatches purely on the receiver type, though there have been plenty of extensions to the language over the years to enable this; Java got this from C++, which I think got it from New Flavors and/or CLOS, or one of the functional languages C# like C++ makes you choose whether instance methods should be dynamically or statically dispatched, rather than assume all the world is dynamic and rely on runtime optimization for performance
|
# ? Oct 15, 2017 11:37 |
|
cinci zoo sniper posted:pascal was the first language i learned but i remember jack poo poo about it My first language that wasn't BASIC was Modula-2 (what Wirth did next after Pascal) - mainly because the compiler for the Atari ST cost about half as much as a C compiler (remember when compilers costed money?). It was alright I guess. The module system is nicer than C, and it's where I first learned what a pointer was and how to do inline assembler. Dead as a doornail now tho.
|
# ? Oct 15, 2017 15:39 |
|
feedmegin posted:(remember when compilers costed money?) im trying to come up with some downside to this transition and ive got nothing usually seems that when something goes to free you lose something, like "now one company controls the project and only their pet features get any work"
|
# ? Oct 15, 2017 15:54 |
|
pokeyman posted:im trying to come up with some downside to this transition and ive got nothing
|
# ? Oct 15, 2017 16:18 |
|
feedmegin posted:My first language that wasn't BASIC was Modula-2 (what Wirth did next after Pascal) - mainly because the compiler for the Atari ST cost about half as much as a C compiler (remember when compilers costed money?). i had to learn modula-2 instead of pascal when i started college, and the only thing i remember is that four weeks in the tutor switched us to pascal because the modula-2 compiler was a giant pile of poo poo that hardlocked the computer if you did things like have text after the semicolon on a line Sweevo fucked around with this message at 16:37 on Oct 15, 2017 |
# ? Oct 15, 2017 16:35 |
|
ctps: Bashing my ahead against CMake How the gently caress is this poo poo getting to be the de-facto c++ build generator? It somehow manages to combine the worst parts of various plangs to become worse than all of them.
|
# ? Oct 15, 2017 16:41 |
|
|
# ? Jun 8, 2024 23:28 |
|
Xarn posted:ctps: Bashing my ahead against CMake c++ build systems are so weird because the language itself is so invested in types and catching incorrect behavior before the program is run and then when it comes to the tooling around it everybody just shrugs and declares stringly typed shell style bullshit "good enough" i think it's because there's so little formalism around how c++ projects are structured. there's no modules, include files can be wherever the hell you want, everything ends up being so system dependent and has so much implied state that even build systems that are in real languages like SCons in python all fall back to hidden global state anyhow plus it's a vicious cycle where build systems suck so nobody wants to deal with them for longer than they have to lest they become known as a build systems person so nobody improves them so they keep sucking. probably the endpoint of the build system is further building things in to toolchains and having those toolchains get a little more opinionated about how things should be structured so the build system has to do less and less other than invoke the compiler once for each output object.
|
# ? Oct 15, 2017 17:52 |