Live data from Hacker News

‘Woof’, a pure Scala 3 logging library

medium.com

41–50 of 50 posts

Re: ‘Woof’, a pure Scala 3 logging library

#41
post #10

Earlier quoted context omitted.

> this falls for the same kind of over-engineering which caused log4j's issues in the first place Because it uses an effects system, which are designed to control side effects like the one which caused log4j's vulnerability, it looks like a reaction against log4j, not "more of the same problem". Whether this is a sound approach or not, I cannot say. But definitely not a case of log4j-like overengineering.

Sadly the effect system isn't granular to narrow down what effect is happening other than "IO", which could be logging, network, disk access, rm -rf /. And without that visibility it doesn't provide you much advantage. Haskell similarly suffers, I'd like to see IO broken down into composable units of functionality so I can see if e.g. my logging library has some ridiculous network constraint.

Who isn't waiting to finally get an usable effect system?

But there is something on the horizon for Scala:

https://github.com/lampepfl/dotty/blob/release-3.1.0/docs/do...

One can have a proper effect system on the JVM also already today with Flix:

https://en.wikipedia.org/wiki/Flix_(programming_language)#Po...

Re: ‘Woof’, a pure Scala 3 logging library

#43
post #13

Earlier quoted context omitted.

Sadly the effect system isn't granular to narrow down what effect is happening other than "IO", which could be logging, network, disk access, rm -rf /. And without that visibility it doesn't provide you much advantage. Haskell similarly suffers, I'd like to see IO broken down into composable units of functionality so I can see if e.g. my logging library has some ridiculous network constraint.

I suspect the same re: this library: IO is indeed too broad, and a logging system needs to do IO. You could use other monads though. > Haskell similarly suffers Haskell practitioners aim to write as much code as possible outside the IO monad. If everything you write lives inside that monad, what's the benefit? The nice thing about Haskell is that if you write every function with IO in its signature, it's bound to rai…

I think the point was that for that remaining bit that can’t be extracted into pure functions still is really broad in what it can do with just “IO”

IO on it’s own could mean disk, network, environment variables, sub processes, etc.

My take away is that they’d like to see IO defined as the union of its parts that can also be decomposed, so you’d have a DiskIO monad or ExecIO

That way you can be more certain that you’re not accidentally going to do a bunch of network io before your sub process kicks off. Right now you can’t have that guarantee (out of the box, at least. idk if there’re any user land libraries to do such a thing)

Re: ‘Woof’, a pure Scala 3 logging library

#44
post #30

Earlier quoted context omitted.

Add to it the disease that all guest languages suffer from creating idiomatic wrappers instead of just directly calling into the rich ecosystem of the existing platform.

That's true to some extent of the native language as well. Hibernate, for example, is a java(-bean) idiomatic wrapper on top of JDBC. Same goes for Log4J being a wrapper of java.util.logging, etc. Not quite the same thing as what Scala or Clojure have done, but far from just sticking to the basics. It's one thing to build a wrapper on top of a comprehensive standard library, and another thing altogether to build what…

I think calling Hibernate "a wrapper around JDBC" is overreaching. A wrapper brings to mind (at least to me) this idea of a thin layer, mostly a simple translator between two worlds, but in this case there's tons of added complexity and pitfalls on top of JDBC, and there's the whole ORM deal with attending object-relational impedance mismatch, the whole "ORM is the Vietnam of Computer Science", and a completely different can of worms!

Re: ‘Woof’, a pure Scala 3 logging library

#45
post #33

I'm sorry but I don't understand why . It seems like this falls for the same kind of over-engineering which caused log4j's issues in the first place. > Announcing Bark! A logging library written purely in C! Blazingly fast! 0 dependencies! It even prints file and line numbers! #ifdef DEBUG #define LOG(msg, ...) printf("[__FILE__ __LINE__]: " msg, ...) #else #define LOG(msg, ...) #endif

Ah, but does it also plug into syslog and is able do cluster logging via Sun RPC?

You jest but we needed syslog in a past job so this snippet indeed wouldn't have worked.

The old adage holds true: "users only need 20% of this system's features, but the problem is that every user needs a different 20%!"

Re: ‘Woof’, a pure Scala 3 logging library

#46
post #13

Earlier quoted context omitted.

I suspect the same re: this library: IO is indeed too broad, and a logging system needs to do IO. You could use other monads though. > Haskell similarly suffers Haskell practitioners aim to write as much code as possible outside the IO monad. If everything you write lives inside that monad, what's the benefit? The nice thing about Haskell is that if you write every function with IO in its signature, it's bound to rai…

I think the point was that for that remaining bit that can’t be extracted into pure functions still is really broad in what it can do with just “IO” IO on it’s own could mean disk, network, environment variables, sub processes, etc. My take away is that they’d like to see IO defined as the union of its parts that can also be decomposed, so you’d have a DiskIO monad or ExecIO That way you can be more certain that you’…

Agreed, and as another person commented, a logging system doesn't actually need to live in the (too broad) IO monad.

Re: ‘Woof’, a pure Scala 3 logging library

#47

I don't get it: Why do we need category theory and monads for every little fart?

"Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something."

"Don't be snarky."

https://news.ycombinator.com/newsguidelines.html

Re: ‘Woof’, a pure Scala 3 logging library

#48
post #30

Earlier quoted context omitted.

Add to it the disease that all guest languages suffer from creating idiomatic wrappers instead of just directly calling into the rich ecosystem of the existing platform.

That's true to some extent of the native language as well. Hibernate, for example, is a java(-bean) idiomatic wrapper on top of JDBC. Same goes for Log4J being a wrapper of java.util.logging, etc. Not quite the same thing as what Scala or Clojure have done, but far from just sticking to the basics. It's one thing to build a wrapper on top of a comprehensive standard library, and another thing altogether to build what…

Writing higher level abstractions for ease of use in same language as the platform is written on, and creating wrappers just because it looks "ugly" to do direct FFI calls to the host language isn't really the same thing.

Re: ‘Woof’, a pure Scala 3 logging library

#49
post #30

Earlier quoted context omitted.

This problem with the scala community exists because it is composed of two different philosophical schools of thought. There's the ML camp, which is where we get all of the awesome pragmatic features of the ML family of languages (Martin Odersky has been very clear that Scala is philosophically an ML-family language). And then we get the Haskell camp, which rightly determined that the Haskell ecosystem was terrible.…

Add to it the disease that all guest languages suffer from creating idiomatic wrappers instead of just directly calling into the rich ecosystem of the existing platform.

In Clojure(Script) it seems to be a net positive because of the curation effect - the community generally has good taste in picking the good parts of the JVM/npm ecosystems and packaging those to for wide use. For example the de facto standard logging library doesn't use log4j but can interop with Java logging stuff and presents the same interface on both ClojureScript and JVM.

(Also many Java libraries have imperative APIs for no good reason, and it's sometimes the wrapper can present a functional interface)

Re: ‘Woof’, a pure Scala 3 logging library

#50
post #49
post #30

Earlier quoted context omitted.

Add to it the disease that all guest languages suffer from creating idiomatic wrappers instead of just directly calling into the rich ecosystem of the existing platform.

In Clojure(Script) it seems to be a net positive because of the curation effect - the community generally has good taste in picking the good parts of the JVM/npm ecosystems and packaging those to for wide use. For example the de facto standard logging library doesn't use log4j but can interop with Java logging stuff and presents the same interface on both ClojureScript and JVM. (Also many Java libraries have imperati…

The reason being that they are older than Java 8, and not everyone buys into functional styles.

Even on .NET, with LINQ having been introduced in .NET 3.5, there might come up some PR discussions that I will just give up and rewrite the code to the expectation level of the audience.

Post reply on HN