On 08/12/2012 10:17 AM, Johannes Pfau wrote:
There are probably some more, less known use cases. For example this
recent thread on stackoverflow shows how scope might be necessary to
initialize an immutable variable.
http://stackoverflow.com/questions/11860584/changing-immutable-members-inside-t
On Sunday, 12 August 2012 at 11:28:28 UTC, bearophile wrote:
Paulo Pinto:
As for the speed of native code produced by JITs for dynamic
languages,
I think Cog(Smalltalk), Self(Smaltalk ended up becoming JVM
Hotspot),
PyPy (Python), V8(JavaScript), LLVM(Julia) prove that you can
get pretty clos
Paulo Pinto:
As for the speed of native code produced by JITs for dynamic
languages,
I think Cog(Smalltalk), Self(Smaltalk ended up becoming JVM
Hotspot),
PyPy (Python), V8(JavaScript), LLVM(Julia) prove that you can
get pretty close to C for the majority of use cases that matter
to the commo
Am Sun, 12 Aug 2012 00:17:44 +0200
schrieb Timon Gehr :
> On 08/11/2012 01:24 PM, Marco Leise wrote:
> > Am Fri, 10 Aug 2012 15:56:53 +0200
> > schrieb Timon Gehr:
> >
> >> int eval(scope Expr* e){
> >> final switch(e.tag) with(Expr.Tag){
> >> case val: return e.i;
> >>
Am 11.08.2012 20:37, schrieb Peter Alexander:
On Saturday, 11 August 2012 at 18:04:29 UTC, Paulo Pinto wrote:
On Saturday, 11 August 2012 at 16:12:14 UTC, Peter Alexander wrote:
On Saturday, 11 August 2012 at 14:45:55 UTC, Russel Winder wrote:
On Sat, 2012-08-11 at 02:19 +0200, David Piepgrass
Am Sun, 12 Aug 2012 00:17:44 +0200
schrieb Timon Gehr :
> On 08/11/2012 01:24 PM, Marco Leise wrote:
> > Am Fri, 10 Aug 2012 15:56:53 +0200
> > schrieb Timon Gehr:
> >
> >> int eval(scope Expr* e){
> >> final switch(e.tag) with(Expr.Tag){
> >> case val: return e.i;
> >>
On 08/12/2012 12:34 AM, David Nadlinger wrote:
On Saturday, 11 August 2012 at 22:17:44 UTC, Timon Gehr wrote:
Will generated code differ?
Only the mangled symbol name will differ. (unlike when scope is used on
delegate parameters, in this case it prevents closure allocation at
the call site.)
On Saturday, 11 August 2012 at 22:17:44 UTC, Timon Gehr wrote:
Will generated code differ?
Only the mangled symbol name will differ. (unlike when scope is
used on
delegate parameters, in this case it prevents closure
allocation at the call site.)
The code for callee stays the same, yes, but
On 08/11/2012 01:24 PM, Marco Leise wrote:
Am Fri, 10 Aug 2012 15:56:53 +0200
schrieb Timon Gehr:
int eval(scope Expr* e){
final switch(e.tag) with(Expr.Tag){
case val: return e.i;
case plus: return eval(e.a) + eval(e.b);
case minus: return eval(e.a) - eva
On 8/11/2012 11:04 AM, Paulo Pinto wrote:
On Saturday, 11 August 2012 at 16:12:14 UTC, Peter Alexander wrote:
You missed the native efficiency part :-)
You mean like the Common Lisp compilers that are able to beat FORTRAN compilers
in floating point computations?
Floating point code is a rat
On Saturday, 11 August 2012 at 18:04:29 UTC, Paulo Pinto wrote:
On Saturday, 11 August 2012 at 16:12:14 UTC, Peter Alexander
wrote:
On Saturday, 11 August 2012 at 14:45:55 UTC, Russel Winder
wrote:
On Sat, 2012-08-11 at 02:19 +0200, David Piepgrass wrote:
[…]
I hope someday to have a programmin
On Sat, 2012-08-11 at 18:12 +0200, Peter Alexander wrote:
> On Saturday, 11 August 2012 at 14:45:55 UTC, Russel Winder wrote:
[…]
> >
> > Isn't that language Lisp?
> >
>
> You missed the native efficiency part :-)
Most modern Lisp implementations employ JITing one way or another, so
you do get
On Saturday, 11 August 2012 at 16:12:14 UTC, Peter Alexander
wrote:
On Saturday, 11 August 2012 at 14:45:55 UTC, Russel Winder
wrote:
On Sat, 2012-08-11 at 02:19 +0200, David Piepgrass wrote:
[…]
I hope someday to have a programming system whose features
are not limited to whatever features the
On Saturday, 11 August 2012 at 14:45:55 UTC, Russel Winder wrote:
On Sat, 2012-08-11 at 02:19 +0200, David Piepgrass wrote:
[…]
I hope someday to have a programming system whose features are
not limited to whatever features the language designers saw
fit to include -- a language where the users
On 08/10/12 14:32, bearophile wrote:
> (Repost from D.learn.)
>
> Through Reddit I've found a page that shows a small example of Rust code:
>
> http://www.reddit.com/r/programming/comments/xyfqg/playing_with_rust/
> https://gist.github.com/3299083
>
> The code:
>
On Sat, Aug 11, 2012 at 2:19 AM, David Piepgrass wrote:
> I must say though, that while ADTs are useful for simple ASTs, I am not
> convinced that they scale to big and complex ASTs, let alone extensible
> ASTs, which I care about more.
You mean AST for D code?
> Nevertheless ADTs are at least
On Saturday, 11 August 2012 at 11:47:43 UTC, simendsjo wrote:
If I'm not mistaken, scope will enforce that the reference
never escapes the function.
So you cannot pass it to other functions that might keep it's
reference or store it in any way.
It _should_ enforce that, but its implementation
On Sat, 11 Aug 2012 13:24:12 +0200, Marco Leise wrote:
Am Fri, 10 Aug 2012 15:56:53 +0200
schrieb Timon Gehr :
int eval(scope Expr* e){
final switch(e.tag) with(Expr.Tag){
case val: return e.i;
case plus: return eval(e.a) + eval(e.b);
case minus: return eval
Am Fri, 10 Aug 2012 15:56:53 +0200
schrieb Timon Gehr :
> int eval(scope Expr* e){
> final switch(e.tag) with(Expr.Tag){
> case val: return e.i;
> case plus: return eval(e.a) + eval(e.b);
> case minus: return eval(e.a) - eval(e.b);
> }
> }
Can you quickly e
On Sat, 2012-08-11 at 02:19 +0200, David Piepgrass wrote:
[…]
> I hope someday to have a programming system whose features are
> not limited to whatever features the language designers saw fit
> to include -- a language where the users can add their own
> features, all the while maintaining "nat
On Saturday, 11 August 2012 at 11:24:35 UTC, Marco Leise wrote:
Can you quickly explain the use of scope here? Does that mean
"I wont keep a reference to e"?
What are the implications? Does scope change the method
signature? Does the compiler enforce something? Will generated
code differ? Does
On 8/10/2012 5:19 PM, David Piepgrass wrote:
Your version is basically a very long-winded way to say "auto x = 5 - (3 + 1);"
so it really has nothing to do with the example.
The point of the example was to represent a simple AST and store it on the
stack, not to represent + and - operators as pl
On 8/10/2012 3:42 PM, bearophile wrote:
Walter Bright:
I'd say we're doing all right.
Are you serious?
You can also do things called "expression templates" in D:
import std.stdio;
auto val(T)(T v) { static struct S { T v; int eval() { return v; }} auto s =
S(v); return s; }
auto plus(
Walter Bright:
Thank you for the answer.
3. If you write Rust code in D, it will not work as well as
writing Rust in Rust.
If you want D code to perform, you gotta write it in D. Not in
Rust, C, or Java.
I agree. Every language has its strengths and its specific
qualities, so you can't as
I'd say we're doing all right.
Are you serious?
Yes. What's wrong with my D version? It's short and to the
point, works, and produces optimal code.
Your version is basically a very long-winded way to say "auto x =
5 - (3 + 1);" so it really has nothing to do with the example.
The point o
On 8/10/2012 5:02 PM, José Armando García Sancio wrote:
On Fri, Aug 10, 2012 at 4:35 PM, Walter Bright
It appears that Rust does not have function overloading. Is this correct?
That is correct.
Well, the type class thing looks like a lame substitute. Sorry.
On Fri, Aug 10, 2012 at 4:35 PM, Walter Bright
wrote:
> On 8/10/2012 4:19 PM, Walter Bright wrote:
>>
>> You can also use templates with overloading to get stack allocated
>> parametric
>> polymorphism and zero runtime overhead.
>
>
> It appears that Rust does not have function overloading. Is thi
On 8/10/2012 4:19 PM, Walter Bright wrote:
You can also use templates with overloading to get stack allocated parametric
polymorphism and zero runtime overhead.
It appears that Rust does not have function overloading. Is this correct?
On 8/10/2012 3:46 PM, bearophile wrote:
Walter's code seems to miss the point, but maybe he's trying to tell me
something about very small demo programs.
If you want something allocated on the stack, us a struct, not a class.
It's what structs are for.
You can also use templates with overloadi
On 8/10/2012 3:42 PM, bearophile wrote:
Walter Bright:
I'd say we're doing all right.
Are you serious?
Yes. What's wrong with my D version? It's short and to the point, works, and
produces optimal code.
Tove:
I think version 2 would be the easiest one to improve, by
including a combined emplace/alloca convenience function in
Phobos for this common use-case.
See the technique used in:
http://www.digitalmars.com/d/archives/digitalmars/D/run-time_stack-based_allocation_166305.html
"auto Create
Walter Bright:
I'd say we're doing all right.
Are you serious?
Bye,
bearophile
On 8/10/2012 5:32 AM, bearophile wrote:
Through Reddit I've found a page that shows a small example of Rust code:
Here's the D version:
-
import std.stdio;
struct expr {
int val;
int eval() { return val; }
}
expr plus (expr a, expr b
One simple possibility is
import std.stdio;
struct Expr{
enum Tag { val, plus, minus }
union{int i;struct{Expr* a, b;}}
Tag tag;
}
Expr val(int i){ Expr e;e.tag=Expr.Tag.val;e.i=i;return e;}
Expr plus(Expr* a, Expr* b){Expr e;e.tag=Expr.Tag.plus; e.a=a;
e.b=b;return e;}
Expr minus(Ex
On Friday, 10 August 2012 at 12:32:28 UTC, bearophile wrote:
This second D version uses the same class definitions, but
allocates the class instances on the stack. The code is bug
prone and ugly. The other disadvantages are unchanged:
void main() {
import std.stdio;
import std.conv:
(Repost from D.learn.)
Through Reddit I've found a page that shows a small example of
Rust code:
http://www.reddit.com/r/programming/comments/xyfqg/playing_with_rust/
https://gist.github.com/3299083
The code:
https://gist.github.com/3307450
-
So I'v
36 matches
Mail list logo