Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>But with the current community, I'm afraid they'll never figure this out.

I hope that remains the case. File structure inferred namespacing to save one line per file seems like a ridiculous breaking change. If you're looking for succinctness to the level that something like that matters in your line/character count, use Perl or something.

If you're looking for something like scripting without a lot of fanfare, just look at https://devblogs.microsoft.com/dotnet/announcing-dotnet-run-...





I never understood people who advocate radical succinctness so typing a program is optimal when most programming time is spent in reading documentation and debugging.

It's not radical succintness. I just like to write pure functions. C# embraces many fp idioms, but in the end makes it hard to use them without a lot of ceremony.

So what I see is a very capable language, with generics far ahead of golang, but a pain to write because I need to nest them inside namespaces and classes. If you take the HN crowd for instance (which is what a lot of startups are like), nobody wants to write Java-style OOP. C# can simplify it quite a bit (retaining full backward compat), but likely won't.


> I just like to write pure functions. C# embraces many fp idioms, but in the end makes it hard to use them without a lot of ceremony.

Then... maybe F# would be more your bag?


Agreed with this. I happen to work on some Unity projects that do not have namespace and file structure in sync. Unity makes this more likely to some extent.

Features like this just cause more unexpected and surprising things to happen.

I always tell folks I work with to have a “reader bias” when writing code. People bend backwards to add fancy reflection and magic to automatically save 3 lines of code then spend days of headache debugging it when it causes a problem.


I like your phrase. I’ll be borrowing it.

Like all seasoned ICs I say the same thing, but yours is more succinct.


> ridiculous breaking change

Not at all. This can be done without breaking code. The important part isn't typing the namespace - rather, the freedom to move files around without having to change namespaces.

Even if it were something like:

  auto namespace; // for example
it's good enough. Allows me to move directories around, without having to depend on an IDE to keep namespaces in sync. IDEs anyway can only take a good guess at this, if namespace doesn't match the dir name.

> just look at https://devblogs.microsoft.com/dotnet/announcing-dotnet-run-...

I am not looking for a scripting solution. C# is a misfit for it. I want all of C#, with terseness and not forcing OOP.


> Allows me to move directories around, without having to depend on an IDE to keep namespaces in sync.

So... without and IDE, you'd move code around, let the NS be changed due to being placed in a different directory structure, and then fix namespaces on use-sites manually?

> I want all of C#, with terseness and not forcing OOP.

C# does not force OOP on you. You can have a single namespace, single static partial class and spread its members across as many files as you want. So the "ceremony" consists of the following snippet _per file_

    namespace NS;
    static partial class C {
        // Your methods here
    }

How would the caller reference that auto-namespaced class?



Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: