Difference between regular expression modifiers (or flags) ‘m’ and ‘s’?

It’s not uncommon to find someone who’s been using regexes for years who still doesn’t understand how those two modifiers work. As you observed, the names “multiline” and “singleline” are not very helpful. They sound like they must be mutually exclusive, but they’re completely independent. I suggest you ignore the names and concentrate on what … Read more

How does extern work in C#?

Consider reading section 10.6.7 of the C# specification, which answers many of your questions. I reproduce part of it here for your convenience: When a method declaration includes an extern modifier, that method is said to be an external method. External methods are implemented externally, typically using a language other than C#. Because an external … Read more

Can you alter a Javascript function after declaring it?

You can do all kinds of fun stuff with javascript, including redefining functions: let a = function() { return 1; } console.log(a()); // 1 // keep a reference let old = a; // redefine a = function() { // call the original function with any arguments specified, storing the result const originalResult = old.apply(old, arguments); … Read more

Pros and cons of package private classes in Java?

The short answer is – it’s a slightly wider form of private. I’ll assume that you’re familiar with the distinction between public and private, and why it’s generally good practice to make methods and variables private if they’re going to be used solely internally to the class in question. Well, as an extension to that … Read more

Jetpack Compose – Order of Modifiers

There’s Layouts in Jetpack Compose codelab containing Layout modifiers under the hood step which explains the modifier order, see “Order matters” section. order matters when chaining modifiers as they’re applied to the composable they modify from earlier to later, meaning that the measurement and layout of the modifiers on the left will affect the modifier … Read more

What does the “static” modifier after “import” mean?

See Documentation The static import declaration is analogous to the normal import declaration. Where the normal import declaration imports classes from packages, allowing them to be used without package qualification, the static import declaration imports static members from classes, allowing them to be used without class qualification. So when should you use static import? Very … Read more

tech