Having to do with issues arising when implementing a programming language.
Questions tagged [language-implementation]
141 questions
5
votes
2 answers
inspect.currentframe() may not work under some implementations?
According to the docs:
inspect.currentframe()
Return the frame object for the caller’s stack
frame.
CPython implementation detail: This function relies on Python stack
frame support in the interpreter, which isn’t guaranteed to exist in
all…

max
- 49,282
- 56
- 208
- 355
5
votes
1 answer
How to add traceback/debugging capabilities to a language implemented in python?
I'm using python to implement another programming language named 'foo'. All of foo's code will be translated to python, and will also be run in the same python interpreter, so it will JIT translate to python.
Here is a small piece of foo's…

Thiago Padilha
- 4,590
- 5
- 44
- 69
5
votes
5 answers
How can an implementation of a language in the same language be faster than the language?
If I make a JVM in Java, for example, is it possible to make the implementation I made actually faster than the original implementation I used to build this implementation, even though my implementation is built on top of the original implementation…

ApprenticeHacker
- 21,351
- 27
- 103
- 153
5
votes
4 answers
In Lisp and other functional languages, why is length not O(1)
The list primitives in Lisp have the opperator length defined as follows:
(define (length lst)
(if (null? lst) 0 (+ 1 (length (cdr lst)))))
Why can't implementers of some Lisp make length a primitive computed in constant time?
Thanks

Joseph Victor
- 819
- 6
- 16
5
votes
2 answers
Does Java have to be compiled to bytecode?
Does the Java Language Specification mandate that Java is compiled to Java byte code?
From what I understand, this is not the case:
JLS 1
Compile time normally consists
of translating programs into a machine-independent byte code…

phant0m
- 16,595
- 5
- 50
- 82
5
votes
1 answer
Why does Boolean::New() return a Handle<> while other primitives return Local<>?
These are the functions to create new primitives in the V8 C++ API:
Handle v8::Boolean::New(bool value)
Local v8::Number::New(double value)
Local v8::String::New(const char *data, int length=-1)
I wonder why Boolean returns…

ThiefMaster
- 310,957
- 84
- 592
- 636
4
votes
1 answer
How to virtual functions and vtables work?
While the C++ standard leaves the implementation of virtual dispatch up to the compiler, there are only 3 major compilers (gcc, clang and msvc) at this point.
How do they implement virtual dispatch, when you invoke a method on an abstract base…

Yakk - Adam Nevraumont
- 262,606
- 27
- 330
- 524
4
votes
11 answers
C pointers in C#
Is this function declaration in C#:
void foo(string mystring)
the same as this one in C:
void foo(char *)
i.e. In C#, does the called function receive a pointer behind the scenes?

Guy
- 65,082
- 97
- 254
- 325
4
votes
3 answers
Matlab: how to implement a dynamic vector
I am refering to an example like this
I have a function to analize the elements of a vector, 'input'. If these elements have a special property I store their values in a vector, 'output'.
The problem is that at the begging I don´t know the number…

Peterstone
- 7,119
- 14
- 41
- 49
4
votes
1 answer
Internal mechanism of virtual inheritance
Sample code in C++:
class A {
public:
A(int) {}
};
class B : public virtual A {
public:
B(int b) : A(b) {}
};
class C : virtual public A {
public:
C(int c) : A(c) {}
};
class D : public B, public C {
public:
D() : B(1),…

paper.plane
- 1,201
- 10
- 17
4
votes
1 answer
How is @private implemented?
In Objective-C, I'm curious how access controls for instance variables, like @private,@protected, etc. are implemented.
I had considered that separate structures were being generated in some way like this:
@interface Foo {
int bar;
@private
…

Jonathan Sterling
- 18,320
- 12
- 67
- 79
4
votes
2 answers
What systems out there use non-uniform pointer representation?
Possible Duplicate:
Are there are any platforms where pointers to different types have different sizes?
I have read in several places that pointers of different types may have different representations in standard-conforming C implementations. …

Brad Larsen
- 995
- 1
- 12
- 20
4
votes
2 answers
Where is the stack implemented?
C++ allows the programer to use either stack allocated memory or dynamic memory on the heap. I am fairly clear on how the stack operates (I have created stacks as exercises in C++) but am still curious about how and where "the stack" is defined.…

Jeff-Russ
- 341
- 2
- 10
4
votes
2 answers
How is the self argument magically passed to instance methods?
I'm doing the code academy stream and I have a little experience in Ruby. I don't understand why the check_angles(self) function needs the self parameter.
The reason I'm confused is that I don't understand what is passing the self parameter to the…

Zach Smith
- 8,458
- 13
- 59
- 133
4
votes
3 answers
haskell implementation questions
Haskell is a really great language. I love it. But as a C++ programmer and with some basic knowledge about the computer architecture, I really want to know the implementation details about Haskell.
I mean, for example, map function. I know the…

user3129535
- 61
- 1