|
A common logger used in .net is NLogger. It seems Good Enough for simple things. You can log at different levels of priority (e.g. logger.Debug, logger.Error, logger.Info) and configure the level of logging in your app configuration. You can build the lazy strings for expensive computations w/ your own wrapper interface trivially if need be. This is a much better approach than commenting/uncommenting out code for ad hoc logging. This is also better than having to remember to put if conditionals around all of your logging statements.
|
# ? Feb 28, 2015 23:07 |
|
|
# ? May 10, 2024 14:35 |
|
statically analyze your logging statements to detect side-effects or computations whose results are only consumed by logging statements. I mean seriously are we savages here?
|
# ? Feb 28, 2015 23:18 |
|
Blinkz0rz posted:Why couldn't you do what language, anywhere, doesn't evaluate arguments before passing them to a function i want to know so i know to avoid it
|
# ? Feb 28, 2015 23:31 |
|
Subjunctive posted:statically analyze your logging statements to detect side-effects or computations whose results are only consumed by logging statements. I mean seriously are we savages here? The Something Awful Forums > Discussion > SeriouHardws are / Software Crap > YOSPOS > Terrible programmers hm
|
# ? Feb 28, 2015 23:33 |
|
Dessert Rose posted:what language, anywhere, doesn't evaluate arguments before passing them to a function langs which are non-strict by default. haskell, agda, and miranda for example. ocaml and f# etc make it very easy to do this too but it's opt-in rather than opt-out.
|
# ? Feb 28, 2015 23:34 |
|
Blinkz0rz posted:Why couldn't you do its a generic example and it could be a string or something else or you could be doing more than one thing it doesn't really matter. but yeah in c# it would do the calculateHash and pass that to debug.
|
# ? Feb 28, 2015 23:46 |
|
Dessert Rose posted:what language, anywhere, doesn't evaluate arguments before passing them to a function literally only if logger.debug wraps its arguments in a Func<string> for deferred execution who the gently caress knows why i dunno i'm a bad programmer
|
# ? Mar 1, 2015 00:14 |
|
gonadic io posted:langs which are non-strict by default. haskell, agda, and miranda for example. ocaml and f# etc make it very easy to do this too but it's opt-in rather than opt-out. Add languages with macros-based logging libraries to the list.
|
# ? Mar 1, 2015 00:17 |
|
Space Whale posted:HOLLA HOLLA logger getLogger
|
# ? Mar 1, 2015 00:18 |
|
Dessert Rose posted:what language, anywhere, doesn't evaluate arguments before passing them to a function you should pick one and learn it itll make you a better programmer
|
# ? Mar 1, 2015 00:57 |
|
yeah don't avoid functional languages, they are really good
|
# ? Mar 1, 2015 01:02 |
|
I mean assuming you haven't like. quoted it in a list or whatever. c# doesn't have autoclosure arguments, I guess swift does now tho so at least one curly brace language has it like I expect that type of shenanigans in f#/haskell
|
# ? Mar 1, 2015 01:16 |
|
fleshweasel posted:bikeshedding megathread ok, what should go in the OP?
|
# ? Mar 1, 2015 01:30 |
|
Dessert Rose posted:what language, anywhere, doesn't evaluate arguments before passing them to a function in tcl you have to put []'s around subexpressions, similarly, bash requires $, or ``. there's the lazy evaluated languages, which build thunks, but there are also the term rewriting languages too. oh and prolog, and datalog treat their arguments as symbolic too.
|
# ? Mar 1, 2015 02:45 |
|
yeah and once someone mentioned functional languages i realized lisp macros are technically like that too. i belong in this thread most days
|
# ? Mar 1, 2015 04:24 |
|
Dessert Rose posted:yeah and once someone mentioned functional languages i realized lisp macros are technically like that too. er i thought lisp was a functional language?
|
# ? Mar 1, 2015 04:34 |
|
lisp is a functional language, which basically means that its written in terms of its own data structures. so its not just macros that aren't evaluated before they're passed to function, but any lisp code can be passed before its evaluated
|
# ? Mar 1, 2015 04:52 |
|
Dessert Rose posted:yeah and once someone mentioned functional languages i realized lisp macros are technically like that too. tbf i wasn't taking about a functional language i was just being dumb
|
# ? Mar 1, 2015 05:05 |
|
Barnyard Protein posted:lisp is a functional language, which basically means that its written in terms of its own data structures. so its not just macros that aren't evaluated before they're passed to function, but any lisp code can be passed before its evaluated source yr quotes
|
# ? Mar 1, 2015 05:18 |
|
swift has a thing called @autoclosure where an argument expression is automatically converted to a function by the compiler. the ?? operator uses it foo = foo ?? getDefault() ?? can be executed without evaluating the second expression for the second argument. getDefault() only needs to be evaluated if foo is nil.
|
# ? Mar 1, 2015 05:33 |
|
tef posted:in tcl you have to oh jesus you just gave me a seizure
|
# ? Mar 1, 2015 05:52 |
|
Barnyard Protein posted:lisp is a functional language, which basically means that its written in terms of its own data structures. so its not just macros that aren't evaluated before they're passed to function, but any lisp code can be passed before its evaluated you have to quote a list to pass it to a function unevaluated, whereas a macro always receives its arguments unevaluated (because macros operate on and evaluate to code themselves) also, you can't pass a macro to a function, because a macro expands at compile time where a function evaluates at runtime fleshweasel posted:swift has a thing called @autoclosure where an argument expression is automatically converted to a function by the compiler. yeah it's the only non-functional language i know of that has a feature like that
|
# ? Mar 1, 2015 06:51 |
|
Functional doesn't mean non-strict/lazy. F# and OCaml are strict for example. Haskell is functional and non-strict but it's hardly representative. On a side note, SPJ has said that if Haskell had been strict, he probably wouldn't have been able to resist putting in implicit side-effects the way OCaml has.
|
# ? Mar 1, 2015 06:56 |
|
Mind you too, almost all langs have && and || evaluate their second argument lazily too.
|
# ? Mar 1, 2015 06:57 |
|
gonadic io posted:Mind you too, almost all langs have && and || evaluate their second argument lazily too. Not so stealthy edit MeruFM fucked around with this message at 08:52 on Mar 1, 2015 |
# ? Mar 1, 2015 08:48 |
|
stealth edit because i belong in this thread
|
# ? Mar 1, 2015 08:50 |
|
MeruFM posted:why would you do || lazily??? True || _ = True
|
# ? Mar 1, 2015 08:51 |
|
yeah i realized that as I went through it again in my head for the 20th time
|
# ? Mar 1, 2015 08:53 |
|
everyone who posts in this thread proves they belong here eventually
|
# ? Mar 1, 2015 09:31 |
|
rrrrrrrrrrrt posted:everyone belongs here
|
# ? Mar 1, 2015 10:02 |
|
ya we've definitely had this discussion before we're all terrible every last one of us
|
# ? Mar 1, 2015 14:30 |
|
fleshweasel posted:bikeshedding megathread dehumanize yourself and face to bikeshed
|
# ? Mar 1, 2015 16:26 |
|
|
# ? Mar 1, 2015 16:44 |
|
eschaton posted:dehumanize yourself and face to bikeshed
|
# ? Mar 1, 2015 18:45 |
|
eschaton posted:dehumanize yourself and face to bikeshed
|
# ? Mar 1, 2015 20:05 |
|
personally i think it should be dehumanize yourself and face to bikeshed
|
# ? Mar 1, 2015 20:58 |
|
Bloody posted:personally i think it should be dehumanize yourself and face to bikeshed
|
# ? Mar 1, 2015 21:29 |
|
No assholes
|
# ? Mar 1, 2015 21:30 |
|
dehumanise
|
# ? Mar 1, 2015 21:34 |
|
|
# ? May 10, 2024 14:35 |
|
rrrrrrrrrrrt posted:dehumanise that's the spirit
|
# ? Mar 1, 2015 21:47 |