language-features

What advantages does Sass provide over regular CSS?

I'm trying to decide on technologies for a presentation layer. I have heard Sass talked about enthusiastically but am resistant to learn something new without knowing why it's better than the alternative - in this case plain CSS. Any feedback on Sass would be welcome. Edit: This is also a good discussion on this: SASS: The Better, Mor...

Better alternative for c++ old feature?

c++ has come a long way, it has lot of feature that lead to do same task in n number of ways. What feature do you think should be avoided and list better alternative for the same. Like use SmartPointers in places of pointers ...

what python feature is illustrated in this code?

I read Storm ORM's tutorial at https://storm.canonical.com/Tutorial, and I stumbled upon the following piece of code : store.find(Person, Person.name == u"Mary Margaret").set(name=u"Mary Maggie") I'm not sure that the second argument of the find method will be evaluated to True/False. I think it will be interpreted as a lambda. If th...

Is java.lang.Math.PI equal to GCC's M_PI?

I am coding several reference algorithms in both Java and C/C++. Some of these algorithms use . I would like for the two implementations of each algorithm to produce identical results, without rounding differently. One way to do this that has worked consistently so far is to use a custom-defined pi constant which is exactly the same in b...

Programming features missing in C++ and Java

What are the programming features that are missing in C++ and Java ? For eg. You can't do recursive programming in QBasic ? You can't dynamically allocate memory in QBasic. What would be the good to have features in C++, Java. I think Lisp Programmers will be able to add a few. ...

What is the best way to transition to C from higher level languages?

I'm a web coder: I currently enjoy AS3 and deal with PHP. I own a Nintendo DS and want to give C a go. From a higher level, what basic things/creature comforts are going to go missing? I can't find [for... in] loops, so assume they aren't there, it looks like I'm going to have to declare things religiously, and I assume I have no object...

Is SQL or even TSQL Turing Complete?

This came up at the office today. I have no plans of doing such a thing, but theoretically could you write a compiler in SQL? At first glance it appears to me to be turing complete, though extremely cumbersome for many classes of problems. If it is not turing complete, what would it require to become so? Note: I have no desire to d...

What is the use of the := syntax?

I'm a C# developer working on a VB.NET project, and VS keeps trying to get me to use the := thingie when I call a function with a ByRef parameter like so: While reader.Read() HydrateBookFromReader(reader:=???) . . . the HydrateBookFromReader function has the following signature: Public Function HydrateBookFromReader(ByRef reader As...

What's the difference between interface and @interface in java?

I haven't touched Java since using JBuilder in the late 90's while at University, so I'm a little out of touch - at any rate I've been working on a small Java project this week, and using Intellij IDEA as my IDE, for a change of pace from my regular .Net development. I notice it has support for adding interfaces and @interfaces, what is...

Consider a "disposable" keyword in C#

What are your opinions on how disposable objects are implemented in .Net? And how do you solve the repetitiveness of implementing IDisposable classes? I feel that IDisposable types are not the first-class citizens that they should've been. Too much is left to the mercy of the developer. Specifically, I wonder if there should'nt have be...

What advantages are there to using either AND or &&?

Currently, I'm using && and || instead of AND and OR because that's how I was taught. In most languages, however, both are valid syntax. Are there any advantages to one or the other in any language? I did try to search for this question, but it's a bit hard. It doesn't interpret my input correctly. ...

Hidden Features of HTML

HTML being the most widely used language (at least as a markup language) has not gotten its due credit. Considering that it has been around for so many years, things like the FORM / INPUT controls have still remained same with no new controls added. So at least from the existing features, do you know any features that are not well know...

What one feature would you cut from your favorite language?

It's easy to think of features to add to a language. What feature would you cut from a language, and why? Douglas Crockford says don't use JavaScript's "with" statement. What are the hazard areas in other computer languages? What features have you seen get in the way of software engineering? ...

Can You Loop Through All Enum Values? c#

Hi there, public enum Foos { A, B, C } Is there a way to loop through the possible values of Foo? Basically? foreach(Foo in Foos) ...

What does "this" mean when used as a prefix for method parameters?

I'm sure the answer is something obvious, and I'm kind of embarrassed that I don't really know the answer already, but consider the following code sample I picked up while reading "Professional ASP.NET MVC 1.0": public static class ControllerHelpers { public static void AddRuleViolations(this ModelStateDictionary modelState, IEnumer...

Programming Language Properties that facilitate refactoring?

What are common traits/properties of programming languages that facilitate (simplify) the development of widely automated source code analysis and re-engineering (transformation) tools? I am mostly thinking in terms of programming language features that make it easier to develop static analysis and refactoring tools (i.e. compare Java v...

What features would you add, remove or change in F#?

I've been reading and coding in F# as a hobby for a year now. As I prepare to deploy some code in production, I would like to hear what the SO community thinks could be improved in the language, and hopefully have the F# Team take some ideas from this thread and implement them in future releases. One feature per answer would make it eas...

C#: No implict conversion from Class<Child> to Class<Base>

Following snippet wouldn't compile. With following error: Cannot implicitly convert type 'Container<ChildClass>' to 'Container<BaseClass>' class BaseClass {} class ChildClass : BaseClass {} class Container<T> where T : BaseClass {} class Program { static void Main() { // why doesn't this work? Container<BaseClas...

How does the C++ runtime determine the type of a thrown exception?

If I do the following, how does the runtime determine the type of the thrown exception? Does it use RTTI for that? try { dostuff(); // throws something } catch(int e) { // .. } catch (const char * e) { // .. } catch (const myexceptiontype * e) { // .. } catch (myexceptiontype e) // is this the same as the previous handler? { /...

Chained invocation in Java 7?

I was just reading a Java7 preview presentation (pdf) and there was a slide on Chained Invocation. Here is the example used in the slide: // Construction with setters DrinkBuilder margarita = new DrinkBuilder(); margarita.add(“tequila”); margarita.add(“orange liqueur”); margarita.add(“lime juice”); margarita.withRocks(); margarita.withS...