Questions tagged [keywords]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1 votes
3 answers
930 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
135 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
12k 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,072
1 vote
0 answers
45 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
324 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,652
3 votes
1 answer
86 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 ...
Benjewman's user avatar
  • 313
-6 votes
6 answers
323 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,414
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
261 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
591 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
15 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
33 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 says reinstate Monica's user avatar
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
14 votes
2 answers
3k views

Why is the 'out' keyword used in two seemingly disparate contexts?

In C#, the out keyword can be used in two different ways. As a parameter modifier in which an argument is passed by reference class OutExample { static void Method(out int i) { i = ...
Rowan Freeman's user avatar
0 votes
1 answer
1k views

why "new" keyword is not contextual keyword?

Based on: C# Keywords Keywords are predefined, reserved identifiers that have special meanings to the compiler. and Based on: Contextual Keywords A contextual keyword is used to provide a ...
Ayub's user avatar
  • 169
4 votes
2 answers
340 views

Etymology of 'virtual' (method/method table/inheritance)

As far as I know, it generally refers to late or dynamic bindng. So why a word like late or dynamic wasn't used?
Andrey Moiseev's user avatar
4 votes
1 answer
460 views

Why does DrRacket IDE considers some identifiers as "symbols" and some as "keywords"? What is the difference?

Why does DrRacket (kind of Scheme) IDE highlights some of the identifiers as "keywords" (for example define, lambda, send*), and the others as "symbols" (user defined identifiers, +, -, abs, send, ...
Alexey's user avatar
  • 932
14 votes
5 answers
15k views

When is the register keyword actually useful in C?

I am confused about the use of register keyword in C. It is generally told that its use isn't needed like in this question on stackoverflow. Is this keyword totally redundant in C due to modern ...
Aseem Bansal's user avatar
  • 2,974
15 votes
2 answers
5k views

Why the ugly keywords in C11?

I am currently reading a draft of the C11 specification. The new introduced keywords: _Bool, _Alignof, _Atomic all feel like custom extensions, instead of standard reserved keywords like struct, union,...
Vorac's user avatar
  • 7,119
6 votes
3 answers
849 views

Why the name 'continue' [closed]

The 'continue' keyword in Java (and probably in many other programming languages) is used to skip further execution of the current iteration. Why was the name 'continue' chosen? Why not something ...
Krishnaraj's user avatar
16 votes
5 answers
3k views

Use of keyword "Using" in C# interface

When I'm using C# to write some code and I define an interface using Visual Studio 2010, it always includes a number of "using" statements (as shown in the example) using System; using System....
Onno's user avatar
  • 1,523
1 vote
1 answer
2k views

Understanding clojure keywords

I'm taking my first steps with Clojure. Otherwise, I'm somewhat competent with JavaScript, Python, Java, and a little C. I was reading this artical that describes destructuring vectors and maps. E.g. ...
user avatar
32 votes
13 answers
4k views

Case insensitive keywords in a language [closed]

We're trying to write a custom scripting language. There has been a suggestion to make the language forgiving by providing case insensitive keywords. I personally do not like the idea, but there are ...
Curious's user avatar
  • 635
23 votes
5 answers
10k views

What are some practical uses of the "new" modifier in C# with respect to hiding?

A co-worker and I were looking at the behavior of the new keyword in C# as it applies to the concept of hiding. From the documentation: Use the new modifier to explicitly hide a member inherited ...
Joel Etherton's user avatar