|
fritz posted:optimize it to what? i assume he's wondering if a programmer can declare new variables whenever they like, rather than reusing already declared ones that are no longer needed in order to save memory or registers. the answer is yes: the compiler is better at that than you are, unless you purposely confuse it (i.e., program in C)
|
# ? Jun 10, 2015 05:02 |
|
|
# ? May 26, 2024 02:11 |
fritz posted:optimize it to what? Already answered, but what I was asking was this: if you don't reuse a variable when you could have done so, could LLVM optimize your two variable to have the same address in order to save space? e: ^ yeah that e2: page code terribly everyday VikingofRock fucked around with this message at 05:09 on Jun 10, 2015 |
|
# ? Jun 10, 2015 05:02 |
|
for a very long time gcc wouldn't reuse stack slots within large functions, which tend to be where you end up with a lot of locals. pre-dwarf2 CFI I don't know that gdb could handle that sanely, because stabs didn't include liveness or something.
|
# ? Jun 10, 2015 05:30 |
|
comedyblissoption posted:if you search online more about this F# limitation, youll find a bunch of stockholmed programmers defending it as making your code better because this is obviously the only way to prevent cycles in your definitions Turns out that the VS extension f# power tools will do this (although the feature is not turned on by default??) . It's a VS limitation, not a f# one.
|
# ? Jun 10, 2015 07:08 |
|
VikingofRock posted:Already answered, but what I was asking was this: if you don't reuse a variable when you could have done so, could LLVM optimize your two variable to have the same address in order to save space? decent compilers have been doing that for decades even lovely ones have mostly been doing that for decades
|
# ? Jun 10, 2015 07:52 |
eschaton posted:decent compilers have been doing that for decades I figured, although I could see some issues with determining what is and is not used again. For example, you could have an int a which you use for the first half of the function only, and an int b which you use for the second half only. Except you have an int& c which is a reference to a and an int* d which points to God knows what, and I could see things getting very complicated very quickly (which is why I think JewKiller 3000 had his C disclaimer). Also I didn't know what that optimization is called so I couldn't really google it.
|
|
# ? Jun 10, 2015 08:26 |
|
When the user does it's called 'premature optimisation'
|
# ? Jun 10, 2015 08:59 |
|
honestly unless you're talking about enormous stack-allocated arrays i'm not sure it really matters if you have an empty stack slot or two in your function. register allocation is the important part of lifetime tracking.
|
# ? Jun 10, 2015 09:49 |
|
Soricidus posted:I like the way java does file structure. one public class per file, one package per directory, names must match. it has downsides too and the visibility rules could be better but whenever I read about poo poo like f# I realise how good I have it say what you will about php but psr-0 and psr-4 have been great for making the language decent actually pretty much everything the php-fig have put out has made the language and its use much better i can't believe i'm saying this but modern php isn't half bad
|
# ? Jun 10, 2015 12:06 |
|
nope, it's all bad!
|
# ? Jun 10, 2015 12:14 |
|
Blinkz0rz posted:say what you will about php but psr-0 and psr-4 have been great for making the language decent I didn't think it would be possible to have a post to terrible for this thread, but I'm going to need to ask you to leave.
|
# ? Jun 10, 2015 12:14 |
|
dont get me wrong, i'd never choose php over c# or java willingly but i do a lot of work with inherited code and the last codebase i worked on was a laravel app and it wasn't an entirely unpleasant experience
|
# ? Jun 10, 2015 12:38 |
|
Blinkz0rz posted:dont get me wrong, i'd never choose php over c# or java willingly but i do a lot of work with inherited code and the last codebase i worked on was a laravel app and it wasn't an entirely unpleasant experience you can write a serviceable thing in any language when you are starting fresh with good people. whether it's still nice two years later...
|
# ? Jun 10, 2015 13:37 |
|
VikingofRock posted:I also think that in math/physics code, it's perfectly legitimate to give a variable a name like 'phi', 'theta', or 'rho' in a context where those have widely accepted meanings. For example if you have a function in some physics code which takes a point in spherical coordinates, it's totally cool to call the parameters 'r' (for the radial distance), 'theta' (for the polar angle), and 'phi' (for the azimuthal angle). what pisses me right off though is hundred-line functions, and especially hundred-line functions that store state in the global namespace. gently caress yoooooou. encapsulate your garbage so i can work out which bit stinks
|
# ? Jun 10, 2015 14:02 |
|
there must be some straightforward global liveness analysis that could localize variables for you. right?
|
# ? Jun 10, 2015 14:05 |
|
coffeetable posted:i'm absolutely fine with code full of greek letter names, and sometimes i wish unicode variables were acceptable in mainstream languages. put the greek in the comments/derivation, almost as good and you don't have to worry about idiot hell fuckers adding Cyrillic Ye's to variable names
|
# ? Jun 10, 2015 14:22 |
|
Karl Marx posted:The history of all previous societies has been the history of class struggles. and that struggle continues today. thanks for the MVC wisdom from yesterday.
|
# ? Jun 10, 2015 15:09 |
|
gonadic io posted:Turns out that the VS extension f# power tools will do this (although the feature is not turned on by default??) . It's a VS limitation, not a f# one.
|
# ? Jun 10, 2015 15:12 |
|
comedyblissoption posted:Having folders doesn't matter. F# still forces you to strictly janitor the order of your module executions so that definitions precede use across the entire project. This is to the point that you have to ensure your main function is the last thing declared. lol
|
# ? Jun 10, 2015 15:17 |
|
comedyblissoption posted:Having folders doesn't matter. F# still forces you to strictly janitor the order of your module executions so that definitions precede use across the entire project. This is to the point that you have to ensure your main function is the last thing declared. Oh yeah, I have complained about this before in this very thread more than once.
|
# ? Jun 10, 2015 16:17 |
|
F# is a couple of cool ideas in a batshit package. All the good parts will come to C# soon so gently caress it.
|
# ? Jun 10, 2015 16:20 |
|
only the good parts that don't break backwards compatibility, like not allowing null references would. i like it. it's not as good as haskell imo but it has way better tooling and infrastructure
|
# ? Jun 10, 2015 16:48 |
|
Subjunctive posted:there must be some straightforward global liveness analysis that could localize variables for you. right? (i know absolutely gently caress all about compilers and parsing and all of that stuff)
|
# ? Jun 10, 2015 17:37 |
|
coffeetable posted:if such a thing exists in python, i would be v keen to learn about it guido literally took tco OUT of python because he didn't like it besides, python is interpreted so there's gently caress all optimisations you can do except maybe in ironpython or the other less common compilers for it e: also, even if you wanted to most optimisations would break the direct line-by-line error reporting that is the only reason to use interpreted langs in the first place gonadic io fucked around with this message at 17:56 on Jun 10, 2015 |
# ? Jun 10, 2015 17:53 |
|
is anyone still using python? I thought it was abandoned like ruby.
|
# ? Jun 10, 2015 17:55 |
|
Shaggar posted:is anyone still using python? I thought it was abandoned like ruby. lol
|
# ? Jun 10, 2015 17:59 |
|
python is pretty okay except for its hosed up type system. once that pep that statically types python is implemented or whatever python will be solidly tolerable as a matlab-replacement
|
# ? Jun 10, 2015 17:59 |
|
math majors don't count
|
# ? Jun 10, 2015 17:59 |
|
gonadic io posted:guido literally took tco OUT of python because he didn't like it you sort of have to marvel at how python succeeded despite van rossum being in charge
|
# ? Jun 10, 2015 18:04 |
|
gonadic io posted:besides, python is interpreted so there's gently caress all optimisations you can do except maybe in ironpython or the other less common compilers for it i was under the impression that it was compiled to bytecode and then that was executed. does that not count as compilation?
|
# ? Jun 10, 2015 18:05 |
Physicists (especially astrophysicists) also love python, and have been known to write huge, complex simulations in it. Honestly it's probably not the worst choice of language, because it's cargo-cult-y nature makes for more readable code and its huge standard library means that physicists write less code (and therefore gently caress up less code).
|
|
# ? Jun 10, 2015 18:30 |
|
i like python in fact, im looking into https://pypi.python.org/pypi/pyquery right now, a library which adds jquery like selectors to python
|
# ? Jun 10, 2015 18:35 |
|
Valeyard posted:i like python
|
# ? Jun 10, 2015 18:45 |
My biggest problem with python is that "fail fast" is not one of their design goals. You don't have a compiler to catch anything but the most basic syntax errors, you don't have a type system which keeps you from doing stupid stuff, and a bunch of stuff that should throw an exception doesn't. For example, recently I was doing a thing where I was reading some data from a file, and then cutting out all the entries with some_field < 20. Except I forgot to cast some_field to numerical type. So later in some unrelated function, when I cut out everything where (some_field < 20), I ended up keeping everything because strings are always greater than numbers. So later in some unrelated function, things failed because I was passing it a bunch of junk data (because the things with some_field < 20 were junk). If I had been coding this in a language with a stronger type system, it wouldn't have compiled because the return type of my parsing function would have been wrong. If I had been coding this in a language which threw exceptions for things like comparing '21' with 20, I would have been able to figure things out quickly there. But instead my small mistake in my parsing function broke things way, way later and I wasted a bunch of time trying to figure out why the hell nothing was working. Apparently they've made ('21' > 20) throw an exception in python 3, but everyone still uses python 2 so that doesn't really help.
|
|
# ? Jun 10, 2015 19:02 |
|
i didn't say that i didn't like python, i just would never program in it myself again. however, i would sooner choose it than any other p-lang.
|
# ? Jun 10, 2015 19:07 |
|
i use python 3.
|
# ? Jun 10, 2015 19:08 |
I don't think Python is a bad language, and there are some very nice things about it. I just think it is sometimes very frustrating to work with / maintain.
|
|
# ? Jun 10, 2015 19:10 |
|
So your biggest problem with Python is something that has been fixed?
|
# ? Jun 10, 2015 19:13 |
|
i had a friend who spend days debugging matlab code, because nan's were getting into his code somehow despite a whole load of isnan turns out that when the library said that it returns 'nan' it meant the characters lmao
|
# ? Jun 10, 2015 19:13 |
|
|
# ? May 26, 2024 02:11 |
|
coffeetable posted:i'm absolutely fine with code full of greek letter names, and sometimes i wish unicode variables were acceptable in mainstream languages.
|
# ? Jun 10, 2015 19:20 |