I've already written a generator that does the trick, but I'd like to know the best possible way to implement the off-side rule.
Shortly: Off-side rule means in this context that indentation is getting recognized as a syntactic element.
Here is the offside rule in pseudocode for making tokenizers that capture indentation in usable form...
I recently started learning Python and I was rather surprised to find a 1000 deep recursion limit (by default). If you set it high enough, about 30000, it crashes with a segmentation fault just like C. Although, C seems to go quite a lot higher.
(The Python folks are quick to point out that you can always convert recursive functions t...
Using classic ASP VBScript, coupled to MS SQL Server, we have a function that takes 3 integers, page_id, heading_id, language_id
it looks up the page heading in a translation table...
This table contains roughly 10,000 rows...
The heading column is nvarchar(1000) plus the 3 int columns meaning it's around 2KiB per row max...
so my qu...
So I got started with PHP at version 4, and had to make the switch to 5. Now I understand that version 6 is on the way, and that a lot of things have been re-thought.
The changes may be good ones, but in the future, does anyone know about PHP's roadmap? Does it look like it will flatten out?
...
Why was C# designed this way?
As I understand it, an interface only describes behaviour, and serves the purpose of describing a contractual obligation for classes implementing the interface that certain behaviour is implemented.
If classes wish to implement that behavour in a shared method, why shouldn't they?
Here is an example of wh...
I know that in JavaScript, creating a for loop like this: for(int i = 0; i < arr.length; i++) is costly as it computes the array length each time.
Is this behavior costly in c# for lists and arrays as well. Or at compile-time is it optimized? Also what about other languages such as Java, how is this handled?
...
Lets say I wanted to create some software that models a society. People exist, meet, have children, learn, share experiences etc. Which programming language should I use?
I would assume that a dynamic language that enables me to swap out methods and/or implement types at run-time would reduce the amount of plumbing that i'd otherwise ha...
What with Delphi Prism coming soon, I've been looking at Oxygene (the Remobjects compiler, Delphi Prism will use), and have a found a few features I'd love to see in Delphi Win32. S
...
I have hit upon this problem about whether to use bignums in my language as a default datatype when there's numbers involved. I've evaluated this myself and reduced it to a convenience&comfort vs. performance -question. The answer to that question depends about how large the performance hit is in programs that aren't getting optimized.
...
I am refering to the question on changing the classpath programmatically.
I read and found out that there is some function under System class as getproperties where we can retrieve the properties and then also can set it using setProperties().
The answers however I got was that It Wont work. I have not tried this myself, however, i am ...
function main()
{
Hello();
}
function Hello()
{
// how do you find out the caller is function 'main'?
}
Is there a way to find out call stack at all?
Thanks.
...
Closed as exact duplicate of "How can I find the method that called the current method?"
Is this possible with c#?
void main()
{
Hello();
}
void Hello()
{
// how do you find out the caller is function 'main'?
}
...
With the introduction of Delphi 2009, a lot of features are added to the Object Pascal language. Almost anybody knows about generics and closures, but there are more, and not all of them are documented (or at least hard to find).
What are the lesser known language constructs of OP that you know about?
...
I have a couple of things that I would like to have in VB.NET. Do you have ideas of other functions, methods or extensions of the language you are working with?
Here are mine:
Extended WITH statement (like in Pascal), to change property of more than one object at time in same with-statement:
WITH Button1,Button4
.Enabled=f...
Previously it was .net 2.0 which is the big change in .net developement. many developers are working mostly on this. Presently microsoft has introduced .net 3.0 and yet its next version .net 4.0. So the next version is going to be major change in .net development.
I have listed some features of this...
Workflow foundation
WPF
WCF
Windo...
To assist with a project I'm working on, I request your input to the following questions. I'm looking for your thoughts regarding programming language syntax and built-in capabilities, NOT about available frameworks and libraries.
(1) In the different programming languages you use, what langauge features do you think are lacking?
(2) ...
Is there any way to direct C# to ignore NullReferenceException (or any specific exception for that matter) for a set of statements.
This is useful when trying to read properties from a deserialized object that may contain many null objects in it.
Having a helper method to check for null could be one way but I'm looking for something clo...
What features do you wish were in common languages? More precisely, I mean features which generally don't exist at all but would be nice to see, rather than, "I wish dynamic typing was popular."
...
So I was making a class the other day and used Eclipse's method to create the equals method when I realized that it generated the following working code:
class Test {
private int privateInt;
[...]
public boolean equals(Object obj) {
[...]
Test t = (Test) obj;
if ( t.privateInt == privateInt ) {
[...]
}
}
t.priv...
A recent post about the 'with' statement in Delphi - which in practice I never use because it trades clarity and ease of debugging for superficially 'cleaner' looking code got me thinking; what other language features, in any language, do you think should never be touched? - or at least avoided where at all possible?
The classic example...