3 ms·
C# is also much better than most languages about being able to split code into separately compilable projects with references between them, and multiple applica
by jcparkyn 3y ago
C# is also much better than most languages about being able to split code into separately compilable projects with references between them, and multiple applications referencing the same shared library. Trying to do the same in TS or python (without extra tooling) is an order of magnitude harder.
- Too 3y agoAre you saying that editing .sln and .csproj files can be done without tooling? It’s only convenient as long as you stay in visual studio. Not that I would write C# any other way, but the comparison isn’t exactly fair. It’s very easy to create reusable libs in both TS and Python.
- ygra 3y ago.csproj files are trivial to edit without tooling (the newer SDK-style projects at least; the others are merely easy). It helps to understand how MSBuild works, though. .sln files are mostly needed for Visual Studio and they are not required. Fun fact: solution files can be built by MSBuild and are converted into a normal temporary MSBuild project first for that.
- neonsunset 3y agocsproj is fairly similar to cargo.toml except xml, it is easily edited by hand or CLI tooling. For sln, you just use dotnet new sln, dotnet sln add and remove commands.
- jcparkyn 3y agoI really meant "without third-party monorepo tooling", but SDK-style csproj files can absolutely be edited by hand (I never use the GUI for them, even in VS). Solution files, while an abomination, are mostly optional if you're not using VS. > It’s very easy to create reusable libs in both TS and Python. I've obviously been doing something wrong then, because I've spent many cumulative hours trying to make these work and there's always compromises. Ever tried making an app with create-react-app that uses a shared lib, with reasonable support for HMR (or even just a working live reload), type hints, breakpoints, de-duplicated dependencies, and linting? As for python, is it even possible to do with a standard python install? I can't remember all the issues I ran into, but the conclusion I came to is that doing it without something like poetry (at the very least) is so much effort that it's not worth it (and let's not even think about making it cross-platform). It doesn't help that every single source on the internet seems to recommend a different approach. Compare this to C#, where there's exactly one way to add a reference to a shared library, it takes one line in a csproj file, and it works with just about every type of application out of the box. Edit: To be clear, I'm talking about locally reusable libs, not published and versioned packages.