9
голосов
8ответов
545 просмотров

Why dont languages allow overloading of methods by return value?

c, java and many other languages do not pay attention to return values. int i = func() float f = func() int func() { return 5 } float func() { return 1.3} Why isnt the above legal? Does it make it more difficult to program int i = func(func(func(func2(func3())))) //you dont know what you...

6
голосов
4ответов
1200 просмотров

Convergence of Mathematics and Programming Languages

It seems that there is a strong movement for the convergence of mathematics and computer programming languages, this is notably evidenced by the influence of the lambda calculus on modern languages. Most of the time I do not think with mathematics, I think with logic. It seems to me that many of ...

6
голосов
8ответов
496 просмотров

create a object : A.new or new A?

Just out of curiosity: Why C++ choose a = new A instead of a = A.new as the way to instantiate an object? Doesn't latter seems more like more object-oriented?

37
голосов
11ответов
4613 просмотров

Are design patterns really language weaknesses?

Should today's patterns be seen as defects or missing features in Java and C++? Subroutine was a design pattern for machine language in the 50s and 60s. Object-Oriented Class was a design pattern for C in the 70s. Visitors, Abstract Factories, Decorators, and Façades are design patterns for...

25
голосов
1ответов
4572 просмотров

Are there good reasons for 'private' to work the way it does in Ruby?

It took me a while to understand how private methods work in Ruby, and it really strikes me as being very awkward. Does anyone know if there are good reasons for private methods to be handled the way they are? Is it just historic reasons? Or implementation reasons? Or are there good solid logica...

2
голосов
3ответов
97 просмотров

Fine-grained sandboxing

Scenario: a program running in a byte code virtual machine like Java or Python, wants to evaluate (by compiling on the fly to byte code and then running) a function whose code was automatically generated or supplied from outside. The tricky bit is that the function's code is not trusted -- it ma...

9
голосов
19ответов
2346 просмотров

How to create a language these days?

I need to get around to writing that programming language I've been meaning to write. How do you kids do it these days? I've been out of the loop for over a decade; are you doing it any differently now than we did back in the pre-internet, pre-windows days? You know, back when "real" coders coded...

4
голосов
2ответов
292 просмотров

Why isn't SEL a class in Objective-C?

In Objective-C (at least, the Apple flavor of Obj-C), why is SEL not a class? Is it a matter of efficiency? Is it to prevent some sort of infinite recursion? Was there merely no incentive to make SEL a class? Speculation welcome, but please let me know if an answer is historical truth or speculat...

86
голосов
7ответов
14032 просмотров

Can't set attributes on instance of "object" class

So, I was playing around with Python while answering this question, and I discovered that this is not valid: o = object() o.attr = 'hello' due to an AttributeError: 'object' object has no attribute 'attr'. However, with any class inherited from object, it is valid: class Sub(object): pass...

5
голосов
6ответов
13974 просмотров

whats the difference between a command and a statement

Often when reading about Tcl (e.g. http://antirez.com/articoli/tclmisunderstood.html) you read that "everything is a command". Sometimes you also hear how other languages are, like Tcl, "command languages." To me with my background in other languages, I just view these "commands" as statement...

4
голосов
19ответов
1045 просмотров

What makes a language readable or not readable?

I heard people say they can understand their python code a year later but not their XYZ code. Why? I dont know what is good about python syntax or what is bad about another. I like C# but i have a feeling VB.NET code is easier to read. I am doing language design so what do you find makes code/syn...

98
голосов
3ответов
23662 просмотров

Zero-based month numbering

Some popular programming languages use month numbering which is off by 1 -- JavaScript comes to mind, as does Java, and if memory serves, C is another. I have some questions: If you are going to be ignoring the month numbering used by laypeople, then why not for the sake of consistency also ign...

140
голосов
10ответов
52532 просмотров

Why doesn't a python dict.update() return the object?

I 'm trying to do : award_dict = { "url" : "http://facebook.com", "imageurl" : "http://farm4.static.flickr.com/3431/3939267074_feb9eb19b1_o.png", "count" : 1, } def award(name, count, points, desc_string, my_size, parent) : if my_size > count : a = { "name...

1
голосов
7ответов
409 просмотров

How have "modern OO languages pretty much eliminated [the] overhead for in-process calls"?

I'm reading through the Source Making site, specifically the Refactoring section. On the page describing the Long Method problem, the following statement is made: Older languages carried an overhead in subroutine calls, which deterred people from small methods. Modern OO languages have ...

13
голосов
6ответов
620 просмотров

C# - what are the benefits of "partial" classes?

I'm asking this because I find it quite a dangerous feature to distribute the class definition so that you can't really be sure if you know all about it. Even if I find three partial definitions, how do I know that there's not a fourth somewhere? I'm new to C# but have spent 10 years with C++, m...

13
голосов
10ответов
701 просмотров

Implications of not including NULL in a language?

I know that NULL isn't necessary in a programming language, and I recently made the decision not to include NULL in my programming language. Declaration is done by initialization, so it is impossible to have an uninitialized variable. My hope is that this will eliminate the NullPointerException...

18
голосов
12ответов
4043 просмотров

Which programming languages were designed with Unicode support from the beginning?

Which widely used programming languages were designed ground-up with Unicode support? A lot of programming languages have added Unicode support as an afterthought in later versions, but which widely used languages were released with Unicode support from day one?

1
голосов
11ответов
600 просмотров

Why are C++ inheritance mechanisms opaque?

Why, for example, is there no language support to examine a vtable? Why can't I replace a member function with a new one? I have a gut feeling that there are ways to put such features to good use. Are there any other languages out there which allow me to do such things?

28
голосов
8ответов
7060 просмотров

What makes PHP slower than Java or C#?

This is something I've always wondered: Why is PHP slower than Java or C#, if all 3 of these languages get compiled down to bytecode and then executed from there? I know that normally PHP recompiles each file with each request, but even when you bring APC (a bytecode cache) into the picture, the ...

41
голосов
28ответов
3775 просмотров

does a disaster proof language exist?

When creating system services which must have a high reliability, I often end up writing the a lot of 'failsafe' mechanisms in case of things like: communications which are gone (for instance communication with the DB), what would happen if the power is lost and the service restarts.... how to pi...

40
голосов
7ответов
5772 просмотров

Why Is Dynamic Typing So Often Associated with Interpreted Languages?

Simple question folks: I do a lot of programming (professionally and personally) in compiled languages like C++/Java and in interpreted languages like Python/Javascript. I personally find that my code is almost always more robust when I program in statically typed languages. However, almost every...

4
голосов
7ответов
1732 просмотров

Writing Interpreters in Python. Is isinstance considered harmful?

I'm porting over the interpreter for a domain specific language I created from Scala to Python. In the process I tried to find a way that way pythonic to emulate the case class feature of Scala that I used extensively. In the end I resorted to using isinstance, but was left feeling that I was per...

10
голосов
3ответов
2648 просмотров

Is Qt classified as a c++ library? If not a library, how would you classify QT?

I recently started looking into Qt (I installed Qt 4.5.2 and installed their Eclipse-CDT plugin called "qt integration v1.5.2" and I will do all my development in Linux-Eclipse-CDT-QTintegration). Originally I thought Qt was a straight vanilla C++ library but when I installed and started running...

-1
голосов
4ответов
3798 просмотров

What is this programming language?

mob/verb/test(N as num) What language is this code from?

1
голосов
4ответов
433 просмотров

Naming: BEGIN ~ END vs LIVE ~ EVIL block structured languages

Curly Bracket languages are well known: (wikipedia) Other programming languages can have BEGIN ~ END vs LIVE ~ EVIL block structuring. eg A) BEGIN ~ END, DO ~ END, IF ~ END IF - examples: Ada, Modula, Pascal, PL/I, Ruby etc... B) IF ~ FI, DO ~ OD, CASE ~ IN ~ OUT ~ ESAC - examples...

7
голосов
5ответов
3141 просмотров

What are the Practical Differences Between "associate" and "indexed" Arrays in PHP?

The PHP array type is actually more akin to an an ordered map than a traditional C array. It's PHP's original general use data structure. The manual goes as far to say The indexed and associative array types are the same type in PHP, which can both contain integer and string indices. However, t...

6
голосов
2ответов
966 просмотров

interface for only certain classes?

Can you create an interface which can only be applied to certain classes and subclasses? If my interface is only added to different subclasses of JComponent, and I need to refer to both the methods of JComponent and my interface... how should I do this? Off the top of my head I can accomplish ...

144
голосов
13ответов
51841 просмотров

Why does C++ need a separate header file?

I've never really understood why C++ needs a separate header file with the same functions as in the .cpp file. It makes creating classes and refactoring them very difficult, and it adds unnecessary files to the project. And then there is the problem with having to include header files, but having...

0
голосов
8ответов
1238 просмотров

How would you replace the 'new' keyword?

There was an article i found long ago (i cant find it ATM) which states reasons why the new keyword in C++ is bad. I cant remember all of the reasons but the two i remember most is you must match new with delete, new[] with delete[] and you cannot use #define with new as you could with malloc. I...

6
голосов
1ответов
11364 просмотров

advantages, disadvantages, and difficulties of writing a language to use .NET

I'm thinking about possibly designing/building a language at some point, and what are the advantages, disadvantages, and difficulties of writing it to run on the .NET framework/CLR?