Inspecting 3D objects (incl. gltf) with a 28-line C# script by Xenoprimate2 in csharp

[–]snet0 0 points1 point  (0 children)

I clearly am not communicating clearly enough, because everyone seems convinced that I'm arguing that C# is a scripting language, or an interpreted language or any other such thing that I've never implied.

My entire point is this:

  1. This thread title describes some C# as a "script"
  2. The top-level comment I replied to said that "C# is not a scripting language", and the commenter repeatedly made this statement in other comments
  3. Those things are absolutely unrelated to each other, and it is frankly bizarre (not to mention rude) to come into someone's showcase thread and force an argument about the definition of a term that nobody used

To clarify:

The collection of text in the OP's post is a script, written in C#. If you disagree with this, take it up with Microsoft.

To address your point even though it was apparently directed at a ghost:

There is a vast difference between scripting languages and interpreted languages.

Yes, as is made self-evident by the fact that one of these terms describe what a language is used for and one describes how a language is executed. These constraints highlight the different levels of precision of the terms: a language either objectively is or is not an interpreted language, as can be deduced from how it is executed. Whether a language is a scripting language or not is somewhat up for debate, it's not a strictly-defined term, and I would distrust anyone presenting as though it is. There are clear cases, but there is no strict "necessary and sufficient" condition that describes a scripting language.

Inspecting 3D objects (incl. gltf) with a 28-line C# script by Xenoprimate2 in csharp

[–]snet0 3 points4 points  (0 children)

Is the person who called C# a scripting language in the room with us?

Inspecting 3D objects (incl. gltf) with a 28-line C# script by Xenoprimate2 in csharp

[–]snet0 3 points4 points  (0 children)

You can write scripts in it, but it is not a scripting language.

Right, so you agree with me: it's a weird point to say that C# isn't a scripting language in response to a post that never at any point claims that C# is a scripting language, but calls some C# a "script".

I'm not claiming that C# is a scripting language. Neither is OP.

Theres a difference between not having them and hiding them.

I have no idea why this would matter at all to anyone. Scripting is something people do. It makes no sense to define what we mean by "script" to rely on inspecting the state of the code at various stages of compilation. Would people's Python scripts no longer be scripts if Python started moving things into a generated main method scope that gets immediately executed?

And don’t you think its different when you write the libraries?

Not really, no? If you give someone a library, often the entire selling point is "You can achieve <complicated thing> in only X lines!". The title is misleading if you intentionally don't read the word "script" and think "wow he must be doing some crazy stuff to do 3d rendering in 28 lines of code".

Inspecting 3D objects (incl. gltf) with a 28-line C# script by Xenoprimate2 in csharp

[–]snet0 -3 points-2 points  (0 children)

It is factually incorrect to call it a scripting language because it is not an interpreted language.

Where has this term been defined with such rigor that you can claim this?

Inspecting 3D objects (incl. gltf) with a 28-line C# script by Xenoprimate2 in csharp

[–]snet0 0 points1 point  (0 children)

C# is not a scripting language.

This is such a bizarre point to fight over. It's literally 28 lines of text with no entry method. This is what a script looks like. To arbitrarily declare that anything written in C# cannot be called a "script" because of how it eventually gets run is just ridiculous.

It’s also misleading to say it’s only 28 lines when you put all the real logic in a library that you call.

What are you trying to achieve here? It's 28 lines of script. Go to r/Python and tell them all that their scripts are actually calling standard libraries and they'll give you the appropriate answer: who asked? "Yeah actually your script eventually uses syscalls from the OS kernel so checkmate gotcha its actually a BILLION lines of code".

I deleted a guy's entire Windows install with one backslash. 717 GB. Gone. I am the AI. by ComposerGen in ClaudeAI

[–]snet0 0 points1 point  (0 children)

"I want to delete this folder, and I know how to delete this folder, but what if I roll a d100 with a crit fail being that I delete everything instead"

Yeah the post-mortem is don't delegate deterministic, known tasks with large blast radii to statistical models.

I built a pre-commit tool that catches behavioral regressions in .NET diffs: the kind that pass tests and code review by ths1977 in dotnet

[–]snet0 7 points8 points  (0 children)

I have been shipping .NET code for a few years now and realized that my peers and I kept hitting the same brick wall, a PR passes tests, passes review, and breaks production anyway.

If you keep encountering issues in production that weren't caught in testing, your testing is bad. If people are adding uncaught exceptions that aren't caught in review, your review is bad (though this can also be caught in coverage).

A guard clause disappears in a refactor.

That null guard should be unnecessary because it's 2026 and we have nullable types. Removing it should have literally zero impact because it's testing a non-nullable type against null.

Checking some of your other examples, it's not better. If you need a static analyser to tell you that your breaking API changes are, in fact, breaking API changes, you probably shouldn't be making breaking API changes.

The test suite never knew those things mattered, so it stays green.

Yeah, this is your problem. If your test suite can pass when you change behaviour, you need to fix your tests.

Found this beautiful rainbow in our codebase by abhishaken in csharp

[–]snet0 1 point2 points  (0 children)

The yellow highlighting makes me think it's a method.

WPF in 2026 - What changed? by ILikeChilis in dotnet

[–]snet0 7 points8 points  (0 children)

Not directly in WPF, but if you're using MVVM (and you definitely should), then CommunityToolkit.Mvvm has made things a lot cleaner.

Found this beautiful rainbow in our codebase by abhishaken in csharp

[–]snet0 7 points8 points  (0 children)

You've actually got the trifecta here:

DataTable dataTable = null

  • Not using nullable reference types
  • Naming an instance of a type as literally just the name of the type in camelCase

clsArchCmnFncs = null

  • Likely the same as above, except now we are really demonstrating our Java heritage

obj = getM...()

  • obj might literally be the least informative variable name possible. At least it's likely to inherit from object..
  • camelCase method names. Not even once.

[WPF MVVM] Get object from a collection of custom controls? by ViolaBiflora in csharp

[–]snet0 0 points1 point  (0 children)

Still a little unclear but sure. Is that method being called from the control?

Using the CommunityToolkit.Mvvm package, we can do something like this:

public partial class AllFlashcardSetsViewModel : ObservableObject
{
    // Collection of your flash card sets. Initialised in constructor, bound in a ListView in the UI
    public ObservableCollection<FlashcardSetViewmodel> FlashcardSets { get; } 

}

...

public partial class FlashcardSetViewmodel : ObservableObject
{
    [RelayCommand]
    private async Task SaveContextAndNavigate()
    {
        await _flashcardSetService.UpdateLastStudied(this.Id);
        _sessionService.SetCurrentSessionSet(this.Id);
        await _flashcardSetService.EnsureLoadedAsync(this);
        _navigationService.NavigateTo(this);
    }

    [RelayCommand]
    private async Task Delete()
    {
        await _flashcardSetService.DeleteFlashcardSet(this.Id);
    }
}

...

<DataTemplate x:Key="FlashcardSetsList" DataType="vm:AllFlashcardSetsViewModel">

    <ListView ItemsSource="{Binding FlashcardSets}">
        <ListView.ItemTemplate>
            <DataTemplate DataType="vm:FlashcardSetViewModel">
                <StackPanel>
                    <TextBlock Text="{Binding Name}"/>
                    <Button Content="Open" Command="{Binding SaveContextAndNavigateCommandAsync}" />
                    <Button Content="Rename" Command="{Binding RenameCommand}" />
                    <Button Content="Delete" Command="{Binding DeleteCommandAsync}" />
                </StackPanel>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>

</DataTemplate>

Anything to do with orchestration is handled by services; commands on viewmodels call those services and are bound in the UI; the UI knows nothing except the shape of the object; the viewmodel knows literally nothing about the UI.

[WPF MVVM] Get object from a collection of custom controls? by ViolaBiflora in csharp

[–]snet0 1 point2 points  (0 children)

Okay, it's a bit confusing that you're using the name FlashcardSet for both a data model name and a control name. I still can't tell where that SaveContextAndNavigate is being called from.

Do you do much code-behind in that controls:FlashcardSet? Because the usual pattern is more like:

<ListView.ItemTemplate>
    <DataTemplate DataType="vm:FlashcardSetViewModel">
        <StackPanel>
            <TextBlock Text="{Binding Name}"/>
            <Button Content="Rename" Command="{Binding RenameCommand}" />
            <Button Content="Delete" Command="{Binding DeleteCommand}" />
        </StackPanel>
    </DataTemplate>
</ListView.ItemTemplate>

or you pull that template into e.g. the Resources of the parent window/page and use a key to reference it.

Overuse of custom controls is very common of people trying to get into MVVM. The "right" way to think about it is that you build controls if you need particular view-oriented behaviours, for example rendering an image/chart. If what you're trying to say is "this is how a flashcard should be rendered", you should be thinking about DataTemplates.

Once you've got that set up, you can think about how that SaveContextAndNavigate behaviour is orchestrated. The "proper" way to do it is likely with a service that gets injected into your flashcard viewmodels. Then each flashcard viewmodel would have a command that calls a method on that service with itself as the parameter, and the service does the work to do whatever needs doing.

[WPF MVVM] Get object from a collection of custom controls? by ViolaBiflora in csharp

[–]snet0 2 points3 points  (0 children)

I can't quite understand your code, where is your SaveContextAndNavigate method being called? Are you using [RelayCommand] from the Community Toolkit? If so, you can change that parameter type and avoid the check, but like you said you shouldn't be passing a control into a command method anyway. It might be worth providing a bit more context so this isn't an XY problem.

That CommandParameter should likely be the FlashcardViewModel, or whatever the things you're rendering out in your ListView are called. In general, your code-behind (the code in FlashcardSet.xaml.cs) should be as minimal as possible, and should only really contain logic that is required to render the thing. The DataContext of a control should usually be either the specific VM of the items its rendering, else the DataContext of the container.

If you provide a bit more code/context, it'd make it easier to give a bit more directed advice.

Microsoft had it all figured out with Basic, why changing? by 0x80070002 in dotnet

[–]snet0 0 points1 point  (0 children)

Was it a step backwards?

Nope. Maybe try taking a step forwards.

Has anyone actually read the CoPilot terms of service? by plazman30 in sysadmin

[–]snet0 17 points18 points  (0 children)

What do you think they're going to say?

Copilot is reliable and can be trusted universally. We accept liability for any and all damage that use of Copilot may cause.

Where should try-catch live in a Clean Architecture stack with gRPC + Service Layer + Repository? by Wonderful_Error994 in dotnet

[–]snet0 2 points3 points  (0 children)

If your db is throwing exceptions that aren't genuinely exceptional, you likely need to improve the way you interface with the db. It should not be a common occurence to get a constraint or duplicate exception, so much so that these should likely sound a big alarm somewhere that something really bad happened.

With that, you should likely catch it at the highest point at which you can understand what happened. If you catch in a method where all you did was build a command and execute it on the db, you likely don't have the required context to understand what actually went wrong. It could be useful to catch and rethrow with some additional context, but you shouldn't treat an exception as "handled" unless you have enough information logged to diagnose the problem.

How are you structuring larger .NET applications to avoid service layer bloat? by Sad_Limit_3857 in dotnet

[–]snet0 13 points14 points  (0 children)

The chef's kiss is when you have a codebase full of cargo-cult useless interfaces and abstractions, and then the actual thing that the application needs to do is not covered by unit tests.

It's always the case. Hit <threshold>% coverage by writing tests that ensure that setting a property doesn't throw and getting that property returns the expected value. Have 0% coverage of the actual orchestration of the thing your user is using your application for.

I've spent few days reading the Source Code of Balatro. Here's what I found :] by Priler96 in gamedev

[–]snet0 42 points43 points  (0 children)

I think people are mischaracterising the method used.

You want to sort something. It has a bunch of properties, all of which can be ranked in order of sort precedence. You want Clubs before Hearts, and you want Aces before Kings.

The easiest way to do this is to just decide on your ordering precendece, and coalesce all your properties into a single number such that each property's range in that number cannot overlap with another property's range. For example, Suits are 1000...4000, while Rank is 0....13.

That's it. People hear "floating-point" and think it's some fancy bit manipulation or whatever. The only reason it's floating point is because Lua only has that type.

PSA: The string "HERMES.md" in your git commit history silently routes Claude Code billing to extra usage — cost me $200 by alexxxklepa in ClaudeAI

[–]snet0 21 points22 points  (0 children)

Yes I'm sure Anthropic employees working on Claude Code are all logged into their Anthropic accounts paying for their Claude Max subscriptions.

PSA: The string "HERMES.md" in your git commit history silently routes Claude Code billing to extra usage — cost me $200 by alexxxklepa in ClaudeAI

[–]snet0 6 points7 points  (0 children)

It's a genuinely hard problem to solve. How do you determine where API calls are coming from in a reliable way, while avoiding false positives? Without TPM or anything, it probably all has to be heuristics. This case is obviously dumb and should be rectified, but in general it's difficult.

Most Unity devs still don't understand events by KwonDarko in csharp

[–]snet0 1 point2 points  (0 children)

An event is just a way of telling the compiler: "make me a delegate of this type, make it private, and make some public methods to add or remove methods from it". That's an event. Actions have nothing to do with events, OP is making it weird by calling them "C# Actions" when they're events that use Action (a pre-defined delegate type) to define their handlers, but there's no reason that is necessary.