« first day (1712 days earlier)      last day (2068 days later) » 

1:20 AM
0
A: Would Rebol (or Red) benefit from Lisp-style Macros?

Idan AryeThis is the first time I hear about Rebol, but from a quick look at the Wikipedia page it seems to me that Rebol dialects are just like Lisp macros: they both receive ordinary code of the language that has passed lexical and syntactic(but not semantic!) processing, and process it with their own s...

 
 
1 hour later…
2:43 AM
Interesting response to your question @rgchris ... I never would've thought of macros as being dialects (or v.v.), but I like the idea!
>> do [select #[object! [q: 1 r:]] 'r]
 
; Brought to you by: try.rebol.nl
== none
 
Dang.
Since make object! [q: 1 r:] errors out, maybe that's the real bug, that the construct should cause an "invalid construction spec" error.
But equally, maybe not, since make object! evaluates the spec, and that is specifically what #[] is meant to avoid.
I love this language. It drives me crazy, just like all my girlfriends.
3
 
 
4 hours later…
6:48 AM
@MarkI Never let people drive you crazy when you're within walking distance. Unless you're crazy. In which case: stand outside your house and hitchhike, and when someone picks you up and asks where you want to go...tell them to your house and point out the window.
@MarkI In the coding questions, I've realized I've picked up a habit of enclosing code in comments inside of backquotes here from C++. I'm not sure if there should be any literal backquotes in the source...and apostrophes seem to work just as well and aren't ugly. It's just a MarkDown chat habit and I should drop it.
So I'm writing a blog entry entitled "C Casting Macros for Subversive C++ Programmers" about what I am doing.
 
 
2 hours later…
8:36 AM
5
Q: Is there any way to slip a static_assert into an expression in ISO C++11?

HostileForkIn C++11 it is legal to write, for instance: int b = (some_function_returning_void(), 1020); And you'll get back 1020. But it won't let you write: int b = (static_assert(2 > 1, "all is lost"), 304); The documentation explains the legal spots where static_assert (a keyword, apparently) can ...

@Morwenn --^
268
Q: Upcoming login changes (Stage 1 now LIVE)

Anna LearAs y'all know, our current flavor of "global authentication" leaves a few things to be desired. It's flaky, requires a page refresh, etc. etc. Wouldn't it be nice if you could just sign in once and be automatically logged in across the network? We are ready to roll out Stage 1 of Project "Make...

 
8:55 AM
@HostileFork I had already upvoted both your question and the answer, but I didn't notice it was yours ._____.
 
@Morwenn It's related to my new thing that is going in Coherence 1.5 which is kind of nifty, and working on making it as palatable and unassailable even to die-hard C fogeys...
Here's your preprint copy for review, still tinkering and testing, feedback welcome...
 
Not sure that you want to assert that types are different. In a generic context, you might want to always perform the cast to say "I always want this type, if you don't give it to me, I will cast".
 
@Morwenn This is specifically about C; not generic programming.
But... I don't know.
Maybe a special g_cast that doesn't have the assert? Generic?
 
You can provide both if you document enough :)
strict_cast for the assertion, or something...
 
Really it's only if you're using the cast in a macro that you would want to be able to tolerate arbitrary types...I'm not sure, haven't used it in practice.
 
9:07 AM
Well, using such macros seem reasonable in C :p
 
I guess. Like I say, this is more about the wording for things than which features are picked.
At first I tried to make it very c++ like where a "cast" was a non-triaged cast, ultimately excised from the codebase and forced to an r_cast, s_cast, c_cast ... so it would be mimicking C++. Then I thought "Well, why not make s_cast a cast then, and only call out the r_cast / c_cast with a prefix"
The simple reality is that in C, you almost always want an r_cast. So now you've got r_cast everywhere and no casts. I decided to change the thinking; forget trying to distinguish static and reinterpret casts, and make cast a reinterpret_cast.
 
static_cast is indeed more or less the default cast.
 
That cleaned things up for readability a lot, and then I figured a const cast is really a mutable cast in all the times you'd use it here. But mutable is a scary word and C has file opening with "r" or "w" so I liked w_cast for "make this thing writable that isn't"
 
It's true that when you don't have explicit conversions, reinterpret_cast becomes the only mandatory one.
 
Unless you're trying to pipe together interfaces you don't control and they don't take a const thing but "promise not to modify"...
 
9:12 AM
The only time I remember using a const_cast was in Ren/C++ because Rebol didn't care about const-correctness.
 
You don't work with enough old code :-)
 
True.
 
Or maybe you do work with enough, and it should just be avoided...
 
I don't work with enough code actually.
 
Anyway then I think the [S]tring and [B]inary casts phrase up nicely with Rebol's string and binary concept.
(Originally [S]tring and [B]ytes, because of REBYTE, but REBYTE is just an unsigned char so why not generalize it to that and publish a blog article as documentation?)
@Morwenn would you say the same principle of genericity applies to w_cast? "I don't care what you gave me, take the const off it?" If it's different how is it different?
 
9:18 AM
@HostileFork I fear that yes.
 
@Morwenn check the filters on that compiler. Nice.
 
I was about to say "nice" but that's what you already did.
 
@Morwenn Well, fair enough. The C++11 tack-on was about trying to show what you could do; a bit of evangelism to the C people. But I guess catching if you try to do a writable cast but pass in a target type with a const on it then it shows off the idea enough to make "the point". Also, it generated interesting discussion on this static-assert-in-an-expression. One feature is enough.
Good feedback, thanks.
 
No problem :)
On another topic, I wrote an exceptions system in C. It makes people cry but it was fun.
 
@Morwenn How did it work?
 
9:28 AM
It's based on setjmp and longjmp with some additional trickery.
5
Q: A closed exception system

MorwennI am working on yet another toy project that I named SGL (for "Standard Generic Library" since it mimics some features of C++'s STL as well as a few more utilities from the C++ standard library). Since the library is not meant to be used in real code, I decided that I would have fun and tried to ...

 
@Morwenn Interesting...we should talk about that when I can get past publishing the coherence-related stuff and get to the publishing of the new interface for Ren/C regarding exceptions.
 
Not sure people will want to deal with hand-crafted half-baked exceptions in C when people already don't like them in C++ where they are built into the language.
 
I meant more about techniques, not using that in particular
e.g. compare to what I'm doing
 
Well, I get what you mean then.
@HostileFork Did you know that The Algorithm is working on Celldweller's next album?
 
9:47 AM
@Morwenn Ah right, the octopus. :-) Well sounds like that will put out something you'll be listening to...
 
Eh, the original track is already great. Now I'm just waiting for the remix :p
 
 
2 hours later…
11:41 AM
@Morwenn Re-listening to the octopus4 from the Algorithm tracks, it is pretty good...liking more on second hearing. I think you sent the hardest one to begin with probably...
 
11:56 AM
@HostileFork Probably because I considered it to be the funniest one :)
But the first track is far easier to listen to of course.
 
 
3 hours later…
3:04 PM
http://programmers.stackexchange.com/questions/289140/would-rebol-or-red-benefit-from-lisp-style-macros

Is it often that accepted answers are wrong?
I cannot comment because my rep is too low
manipulating syntax as a data structure is not the same as a macro
 
3:20 PM
@JacobGood1 What makes you say that exactly? I would have said that that's the only thing macros do.
 
well in lisp you can do it without a macro
just like rebol
 
With you so far ...
 
(manip-this '(1 2 3)) => (x 5 z)
no macro required
 
Could be a function or a macro, right ...
 
so what is a macro then?
 
3:22 PM
Hey! I asked you first! :)
 
hehe =P
 
According to wikipedia, the only difference between macros and functions is that macros transform code and functions return results.
 
macros can unroll code and change symbols entirely
 
In Rebol there is no distinction between results and "code transformation".
 
I keep giving this example, but I think it is good(maybe it is not since no one seems to get it)

make every 2 become 500 NO MATTER WHERE it is
 
3:26 PM
I get that one. Completely. What I don't get is why you insist that it is different from do replace/all/deep code 2 500 ...
Is it that macros in your mind "don't have to specify what code they are changing"?
Or maybe that they "go away" after they are done?
 
I can write my 2 over and over and it will be replaced in the repl as I type
a flat out code transformation is not the same
 
Because both of those things are artifacts of the embedding, not the language.
@JacobGood1 But it is, I say. code can include the REPL.
 
so I can make changes in my source and every time I type 2 it will be replaced but not in the source code
 
@JacobGood1 Wow. Lost me there ...
So when you hit the '2' key you want to see '500' appear on the screen? '222' becomes '500500500'?
 
if in the repl
if in the source no
 
3:31 PM
Still lost. And hungry :). Back soon ...
 
we should just screen share lol
that way I can show you since, it is possible, that we are using the same words to mean different things
 
 
5 hours later…
8:17 PM
Okay, light reading for C/C++ folks, @iceflow19 @freezerburn @MarkI @Morwenn @earl ... it's one of my forthcoming commits tidied and explained as a blog entry: "C Casting Macros for Subversive C++ Programmers".
2
 
9:01 PM
>> print [{Hello} (reverse {DneK@})]
red> print {Is RebolBot asleep again?}
Both bots sleeping...I should be too. Stayed up all night on that article and filing some stuff and it's now... almost night again. Zzzz.
 
9:18 PM
@HostileFork Gotta love all-nighters. The only way anything ever gets really done in this crazy industry.
 
 
2 hours later…
11:17 PM
@JacobGood1 I haven't accepted an answer! It's the only answer and folks have voted for it. I'm pretty sure the best way you can get the points needed to comment on that answer are to submit an answer yourself :)
 
11:43 PM
Nice article @HostileFork I'll sort out the lethargic bots tonight
 

« first day (1712 days earlier)      last day (2068 days later) »