Question: The Challenge
-------------

Write a program that outputs `Hello World, from line X!`, where `X` is the line number, in the source code, of the actual print statement itself.

The Rules
---------

* In this context, we want **the *first* line number of the statement which outputs the string** to be displayed to `stdout`
* You should **avoid simply searching through your source code as a string** (either file or quine) to find the line number
* If any **additional whitespace or statements** (which do not interrupt the flow of the code) is added to the source code, it should be **reflected at run-time** (after compiling if applicable)

Recommendations
---------------

If provided by the language, you **may** use exceptions/stack traces to accomplish this goal. Try your best to use code that is **portable** across different systems/implementations, but note that this is **not** a requirement. Using defined variables like `__LINE__`, although allowed by the rules, are discouraged.

The Winner
----------

* This is a **popularity contest** (ended on June 10, 2014), where the **answer voted highest by the community** will be declared the winner based on the current votes at the time
* When voting, please consider the creativity of someone's answer, how elaborate or **interesting** it is. and the difficulties/constraints of the programming language being used

Answer: 
Nimrod
======

```
template lineno(): expr = instantiationInfo().line
echo "Hello, world, from line ", lineno(), "!"

```

It uses Nimrod's templates to generate a call to instantiationInfo, whose information is only valid when used from within a template.

Output:

```
Hello, world, from line 2!

```
x86 Assembly
============

```
.data
LC0:
    .ascii "hello, world! from address %x\n\0"
.text
    .global main
main:
    pushl   %ebp
    movl    %esp, %ebp
    call pop

pop:
    popl    %ebx
    leal    22(,%ebx,1), %ebx
    subl    $8, %esp
    movl    %ebx, 4(%esp)
    movl    $LC0, (%esp)
    call    printf
    movl    $0, %eax
    leave
    ret

```

This prints the memory address where the call to printf is located. This doesn't really work for rule 3, but I feel it's much more interesting than using \_\_LINE\_\_ or a stacktrace.

I should add how it works. Normally you can't get the address of the current instruction pointer by moving it into a register, so what I do is call a function "pop" which really means that the return address of the next instruction is pushed onto the stack and then a jump is executed. I pop this return address into ebx and add 22 to get the address of the printf call. The reason this won't work for rule 3 is that if you insert code before the printf call the address will not be 22 away from the address of the pop ebx.