Skip to main content

Questions tagged [keywords]

0 votes
3 answers
1k views

Why are constants declared with `let`?

A few weeks ago, I went on Udemy course on Swift, the instructor mentioned that constants are called let in Swift because it's standard in OOP (JavaScript uses it for example). I know this may seem ...
Laurens van Oorschot's user avatar
1 vote
1 answer
190 views

Why does java use an @functionalInterface annotation, instead of a modifier?

What were the motivations for java to use the @FunctionalInterface annotation, instead of creating a new FunctionalInterface modifier? @FunctionalInterface public interface MyFunction { TypeB ...
aminator's user avatar
  • 123
9 votes
1 answer
14k views

C# design to force the virtual method to be called from the override, or something similar

We can do something like this: // in base class protected virtual void Init(){ //do stuff that all objects need to do } //in derived class protected override void Init(){ base.Init(); // if ...
WDUK's user avatar
  • 2,092
1 vote
0 answers
54 views

Can Attribute and Property, Method and Function be used inter-changeably in Software world?

Some pairs like these: Method and Function Attribute and Property Argument and Parmameter etc. I use all the three pairs interchangeably when I speak to a peer. Do they have a very critical ...
Bhavya Narula's user avatar
1 vote
2 answers
392 views

Was including a keyword for events a mistake in C#?

C# has events built in with a keyword. So if you want to declare an event, you write: public event MyEventHandler SomethingHappened; It is convenient, as it does allow you to add multiple event ...
Casebash's user avatar
  • 7,672
3 votes
1 answer
94 views

What approaches can I take to figure out the "relevancy" of certain terms in a string?

I'm not even sure "relevancy" is the most accurate word, so I'll just describe the problem: I'm building an app that needs to somehow parse product descriptions from a popular website (let's just say ...
ben_makes_stuff's user avatar
-6 votes
6 answers
382 views

What would be generally accepted shorter version of `const`? [closed]

Now that we have const implemented javascript we can use it to declare variables. But unlike let or var it is 5-character long and I believe it is a big deal actually. Something that even slightly ...
shabunc's user avatar
  • 2,464
1 vote
3 answers
1k views

Is there a common "class=>clazz" equivalent for "interface?

In most languages I've used it's common practice to replace the reserved word class with clazz when you have a variable that refers to a class. This has become a sort of de facto convention, to the ...
machineghost's user avatar
5 votes
2 answers
291 views

Why was the static keyword used here?

In standard C, you have a few options for declaring a function that accepts a pointer to a chunk of data: void style_1(int * arr); void style_2(int arr[]); void style_3(int arr[10]); void style_4(...
Alex Celeste's user avatar
4 votes
3 answers
654 views

Can Lisp keywords be protected?

Why aren't lisp keywords protected? For example, (define a 3) (define define +) #makes define useless (define a 1) #outputs 4, instead of assigning 1 to a. Is this flexibility so important? Or even ...
Quora Feans's user avatar
16 votes
2 answers
3k views

Now that not all method declarations in a Java Interface are public abstract, should the methods be declared with these modifiers?

Starting with Java 8, default methods were introduced into interfaces. Effectively, this means that not all methods in an interface are abstract. Starting with Java 9 (maybe), private methods will be ...
David Campbell's user avatar
18 votes
4 answers
4k views

Why does C# have both out and ref?

C# has the out and ref keywords. Why are these two required? Disclaimer: I don't have deep knowledge of C#.
Neo's user avatar
  • 207
32 votes
1 answer
7k views

Why does C++ not have a "pure" keyword for virtual functions?

I have always wondered why we code virtual void MyFunction() = 0; and not pure virtual void MyFunction(); Is there a reference for the basis of this decision?
Mawg's user avatar
  • 4,308
3 votes
3 answers
4k views

Why does an interface extend an interface instead of implementing it?

In Java suppose that I have interface A: public interface A { // foo } I also have interface B: public interface B extends A { // foo + bar } Why does interface B extend interface A and ...
sixtyfootersdude's user avatar
1 vote
1 answer
2k views

Why VB local variables can be 'static', not 'shared'?

In Visual Basic .NET, I can see different keyword for the same(?) concept: • methods Shared • properties Shared • class-level variables Shared BUT • local variables ...
miroxlav's user avatar
  • 672

15 30 50 per page