« first day (1710 days earlier)      last day (2070 days later) » 

12:22 AM
@JacobGood1 I'm looking around at descriptions of macros and still don't quite get what makes them special. How is that approach to generating code different than my CASE example?
 
You would probably have to program in them a little bit in order to understand their power but I can give you a simple contrived example from good ol shen
(defmacro do-some-craziness
2 -> 500)

(+ 2 1) => 501
I turned every number 2 into 500
basically says when the reader "sees" the number two exchange it for 500
this happens before it is ever compiled so there is no run time cost
Here is another contrived example(code might be hard to read due to familiarity issues)...
In shen functions have a fixed arit, with macros we can act like they dont, for no run time cost(key point)
(defmacro max-macro
[max W X Y | Z] -> [max W [max X Y | Z]])
(define max
X Y -> where (> X Y)
_ Y -> Y) <= notice the fixed arity
now we can say (max 1 2 3 4 5 6 7 8 9)
and get 9
no run time cost
the actual code that gets produced is...

(max 1 (max 2 (max 3 (max 4 (max 5 (max 6 (max 7 (max 8 (max 9)))))))))
anyway I made a thread dialect in rebol
and with macros I could have made it to where there was no run time cost
 
Hm, think I get it. Can you reduce a piece of Rebol code to show where a macro might improve it?
 
Shen has really cool macros, not all lisps have that kinda juice
anyway, I can show you where I needed a macro(i think) I do not know where the code went so ill show you what it was supposed to do
thread fn [
do-something arg1
do-another-thing arg2 arg3
]
so thread should take fn and thread it through those functions
do-another-thing do-something arg1 fn arg2 arg3
and produce that code
 
12:40 AM
Sorry to butt in, but couldn't your dialect rewrite the block of code?
Do your own expansion?
 
yes but I want to drop the block when I am done
I worked with it quite a bit, I believe that this is a good case for macros
 
[sorry, phone]
 
I can't quite see how THREAD is supposed to work, makes it difficult to understand the problem.
i.e. don't know why you'd get the result from that input.
(back in a sec)
 
ill use a lispy syntax
(thread 1
(+ 2)
(- 5))
-2
which would macro expand to...
(- (+ 1 2) 5)
so the value gets "threaded" through the functions
 
12:59 AM
Thus:
thread 1 [
    add 2
    subtract 5
]
Macros aside, that look tricky in Rebol given the lack of parenthesis.
 
Is thread supposed to take general code, or can it make assumptions about the code?
 
sorry was afk
@rgchris yes, @Brett assumption
thread assumes that the first argument is "fillable" or that the first argument has not been taken
 
And do we know that add is a function?
 
macros are just really cool and if they were combined with parse that would be very nice
@Brett these are just examples
but yes it is supposed to be a function
if yall feel like looking at lisp code here is clojures version of thread
 
@JacobGood1 Maybe have a look at rewrite and parse-kit - maybe something there could assist?
 
1:14 AM
@Brett im just going to keep coding and hope that doc will slap macros in red =)
if I run into performance issues then ill have to actually push it a little more(I do not think I will, any time soon anyway)
@Brett I am just trying to show rebolers that macros would be great for rebol, the dsl language
 
@JacobGood1 I've never really used macros, but can understand the code expansion side and think that yes it probably would be useful. However for a DSL you have an opportunity now with Rebol to be able to do that I think.
 
@JacobGood1 In this case, I see the lack of parenthesis as the bigger hurdle in transformation as you have nothing to anchor a dialect to—a word could be a function or an argument, or you might want to use a refinement. Lets assume that the dialect is more uniform—then the difference between a macro and in-place code generation is that the macro is worked out beforehand?
 
I'm assuming what people are asking for is for DO to allow code rewriting on the fly.
 
@rgchris parens do seem essential(maybe they are not?) and to answer the question yes
so parse would run one time, during "macro expansion", the result would be code without a block
 
@JacobGood1 See the Lake article for the difficulty in assuming anything about a block of Rebol code :)
 
1:23 AM
not all people want a feature like this though, especially something like what shen has
it can make modular programming difficult
@rgchris the same could be said for lisp

(you have no idea what the heck this is doing)
 
It might be a case of approaches though—looking at what you're trying to do, I would have THREAD be a function that generates a function that you would pass a value to. this-thread: thread [add 2 subtract 5] this-thread 1
 
yes but if you want to use thread anywhere, on the fly, that is not sufficient
(already thought about that)
 
do thread [add 2 subtract 5] 1 —but I get the code generation part, if this were part of a loop, for example, it'd be slow.
 
@rgchris right on
 
Load the script, replace deep, done. :-)
 
1:30 AM
@Brett it works but it is not really what you want, especially if you are trying to prototype and refactor
 
do expand %some-script.r
 
So when should the expansion take place? Assuming rebol had macros?
 
in lisp you have read time and compile time...

during read time is when the expansion takes place, the reader sees the expanded code while the coder sees the code just as it is. If you want to keep coding something you can keep changing the code as if it is a normal part of your language.
so I could type..

thread 1 [add 3 minus 2]
then think I dont like that...
thread 5 [add 7]
so on and so forth
it expands every time without me knowing or caring
 
Like when rebol loads text into code?
 
take a look at this graphic it is pretty good
the first one on the page
afk
 
1:45 AM
What if I were to:
thread 1 [add 7]
macro thread [value thread][...hypothetical macro grammar...]
thread 1 [add 7]
Would the macro only apply to subsequent invocations?
Would it retroactively apply to the calling script?
thread 1 [add 7]
do %script-containing-macro.r
thread 1 [add 7]
 
Btw @rgchris have you come across Pratt parsers (also known as Top Down Operator Precedence)?
 
2:01 AM
@JacobGood1 There is no compile time in Rebol. AFAIK there won't even really be one in Red. I can't think of a macro example without it's "usefulness" being because of the compilation requirement.
In other words, Rebol is already all macros.
I recommend you peruse rebol.it/power-mezz/mezz/expand-macros.r, it provides exactly what you are asking for, a full-featured macro expansion dialect (superset) of Rebol.
Argh. Got the "it's" wrong again. Stupid English language. On the other hand, no-one will ever notice, unless someone points it out.
 
@Brett No, not by name. Looking...
@MarkI Bzzt, you lose!
 
@rgchris Did you notice? :)
 
@rgchris Here's one url. Was thinking it was a neat little tool to have in back pocket for dialects.
 
@MarkI I might have if I wasn't reading the posts bottom to top :)
 
@rgchris That do can you? Wow.
 
2:11 AM
A scanning habit.
 
@rgchris I can read bottom to top and right to left, but the text has to be upside down or mirrored respectively.
 
ill have to reply to these things later guys, i have to go to bed
good discussions night all
 
@JacobGood1 'Night.
When you come back, let's talk about GENSYM, another Lisp feature not in Rebol, sadly needed IMO.
 
2:44 AM
@rgchris I've made a draft script for parsing with [Pratt's method](codeconscious.com/rebol-scripts/tdopp.r). Still sitting with it at the moment. There's an example in the script. Wondering if the definition method is as concise enough.
 
@Brett Might need to read that a couple of times...
 
@rgchris Yes, I read it and read it and.....
You have to forget parse initially.
 
:D
Took the liberty of: Pratt/TDOP Parsing...
 
Cool.
There are little things that have to change in the script and I've had trouble with isolating the bindings. I may rewrite it if I discover a bettter implementation method for it.
But I think it suits Rebol's "pre-tokenised" code well.
 
I see an it's in an error string (s/b its)—@MarkI would be proud :)
 
2:55 AM
Ahem.
:-)
Like I said there are little things that have to change in the script. :)
Fixed!
 
What do people call their Red binaries? I'd prefer red, but it conflicts with restricted ed, is there another best practice naming?
 
3:13 AM
@BrianTiffin I don't see a consensus—only an acknowledgment that there is a conflict on some systems.
 
Ok. red wins out over restricted ed here, but it will be a thing someday. Someday soon, the way the Doc train seems to be rolling.
 
3:34 AM
@BrianTiffin Hopefully when the time comes, there'll be no contest. restricted ed :)
 
4:06 AM
@Brett Getting there... Should submit to Code Review, can put feedback there.
 
4:16 AM
My take is, that Carl most probably knew, why he does not want Rebol to be another LISP. Nothing against top guru use cases, but my take is - if you want full LISP, go LISP, easy as that
Is LISP is so cool, why to look into Rebol/Red at all?
And if you admit, that Rebol/Red has some other qualities, which are sympathetic for LISPers, will you come to the LISP group, ask them implementing them? :-)
If you want to hear Doc's asnwer for Marcros or Gensym, please, ideally, raise your question here - groups.google.com/forum/#!topic/red-lang/UEdGRrDr8Zg
 
 
5 hours later…
9:27 AM
Lots of... fun with coherence 1.5 :-/ I guess it depends on how you define fun.
Since patching it onto the unforked Atronix/Saphir code is not necessarily so fun given the 800 commits of difference, I stop to write the occasional essay.
I changed the term "Crash()" to "Panic()" because seems experience has borne out that a knowing failure is (historically) not really where the problems have been. Saying "it crashed" is probably very fractionally "System error: this should never happen"
While I was at it, I changed Trap0() to just Trap()... it's rather common, and might become variadic someday anyway.
Anyway, those changes are mainly an outgrowth of ensuring that in the imperative code...with many chances for failure... that at least the compiler can check to see that all paths return a value (modulo that which cannot be checked due to the limits of logic etc.) Yes, I did go back and isolate them out. Said I wouldn't then I did.
 
 
3 hours later…
12:33 PM
@pekr a feature request was made, as are many others. It does not hurt to make such a feature request does it? And yes, I ask for features to be implemented in the languages I like all the time. However, in a lisp, many times I can just extend the language anyway because of macros... I already put a macro question down and he has already stated that he would like to have macros.
I would like for red to be the right tool for the job, where job here means every job known to the human race, lol
A true general purpose language. That term gets thrown around for a lot of languages but red has a unique opportunity for it to be truly general(applicable in all domains)
@HostileFork let me know when a new version of ren garden rolls around =)
 
Makes me think that I should revamp the French translation. I didn't update it since the first release.
 
@JacobGood1 Well, the main thing that happened was that I kind of looked at all there was to do and that I should probably make it as easy as possible for Atronix to pick it up and use it in the same way I'm going to... given business pressure and stuff, it had to be a "you can't not use this" proposition.
 
sounds good, but sounds like it is a ways off... perfection being hard to obtain and all, lol
I am paying good money for it, you need to hurry up!
2
 
In any case, I hadn't completely thought through quite how to do it before, but the end result would be that in a Git repo sense they will "contain" and not "inherit" from the work. So there won't be an attempt to merge, per se. It's just all the files that are common in Ren/C would vanish out of the repo and make a subproject that uses it again... but doesn't try to re-merge those files.
@JacobGood1 Yes sir.
 
12:50 PM
Do not forget my mountain of contributions as well, just gazing at them should inspire you to work harder
 
Discussion is definitely contribution. Someone has to be manning the fort when people show up.
 
joking aside, I am excited to see the consistency that your leadership will bring to the language. I really do hate inconsistencies in languages(like common lisp, dear Lord)
@Morwenn is that your picture? For some reason I thought you were a guy with curly hair...
hopefully that was not too abrasive...
@HostileFork who used to help you with c++ was that not morwenn?
 
@JacobGood1 Well, I do have curly hair. That's a wig on the picture.
 
@Morwenn you are the c++ guru right?
 
@JacobGood1 Guru is a bit strong, but it's indeed me who helped the fork with the tricky C++ stuff :)
 
1:00 PM
oh ok, that wig is throwing me off
@Morwenn you do not actually program in red/rebol right?
 
Indeed, I don't. Since I generally don't have projects, I don't really have anything motivating enough to learn.
 
Do you not program just for fun some times?
 
I do have some library projects. But it's easier to develop a specific component for a specific need when you know a language.
What I develop is rather expert-friendly. I would need an application project to learn a new language. Or the need to script something.
I would like to make a Rebol-based tool to replace CMake to build C and C++ projects but that's too big of a project to start :p
 
That would be really cool
It would force you to learn parse
which, imo, is rebol/red's crown jewel
 
Or I would program it in C++ and let Ren/C++ do most of the job of parsing the Rebol user code :p
 
1:13 PM
Well, it helps to have a fast feedback loop like a repl... also that is cheating =)
@HostileFork that is another thing, I would like to see rebol become a lot more repl focused. You never leave the repl, you program everything interactively. Common lisp is the most extreme example I have seen of this to date. I think Ill slap that down as another question for the user group.
 
@Morwenn I started that once...
 
@HostileFork Why am I not surprised?
 
Hitting problems is one of the reasons I wanted to fix things to be more dialect friendly.
Every time I tried it I found it frustratingly close, but a little too much like the only dialecting Rebol was really focused on and had succeded at was dialecting Rebol.
NewPath was motivated by the CMake dialect replacement.
 
If you make c make(odd sounding) more user friendly the world will rejoice
heck I might even do it
slap a gui on top of it, turn into a full blown game
@HostileFork I am going to be in GA for around a year or so, we should plan a rebol/red meeting
 
Other things I've tried to take old assembly toolsets for game systems like Intellivision and things of that sort (things I didn't have access to...) and I found the "apples to apples" dialecting was just hard. Rebol3 went and made things even more limiting by not letting a word have any string if you created it programmatically...
@JacobGood1 With the CMake game, you might be a runner up for that "reality, worst game ever" poster...
 
1:20 PM
hehe
 
But people do RegEx golf. So...
 
I think I would be the winner since it would take far more effort and stupidity to do what I just said
 
RegEx crossword puzzles. The only winning move... is not to... hold yourself back from going back in time and stopping the person who invented it.
 
That is truly hideous
of course, beauty is in the eye of the beholder...
I am going to learn some game dev down in GA, soon c++ will be my frenemy
@HostileFork I know that you have had issues with doc but will ren garden be usable with red one day?
 
@JacobGood1 That's the plan; though Ren Garden is in most ways less important to me in particular than Ren/C++. Just one application.
 
1:33 PM
Let's say that it's the killer app to promote Ren/C++.
 
And Qt is big and fat. Just easy and well-documented.
 
that makes sense
 
But big fat multiplatform messes is kind of not the goal here.
 
"Easy" -> until you have to integrate it with CMake.
 
however, we all know that as soon as users see a new language the first bleeping thing they say is, "where is the ide at?"
@Morwenn I am assuming that your attraction to rebol/red has to do with lack of dependencies?
 
1:35 PM
@JacobGood1 Partly, but it has mostly to do with the interesting syntax and language design.
 
were you ever interested in a lisp, or do you like the free form style?
 
I'm always surprised at how it managed to incorporate so many built-in literals without ambiguity.
Lisp is kind of elegant from a language design point of view, but I tend to find it unreadable.
 
I think the syntax will always be a barrier
I find it beautiful but most do not
 
That's the problem. Also, I know that infix operators with precedence are horrible and a cognitive burden but I don't like not having them.
 
that depends really, some times they are nicer
since we all learned math that way
 
1:39 PM
Yes, because that's only because we learnt math that way. Otherwise, having to remember the precedence is a serious burden and more or less a lack of inconsistency.
 
(* (abs (cos (** (* (/ (+ 1 2 6 5) 7) 8) 25) 0.3) 33 69)
some times that can be quite a burden
 
And trying to provide a mechanism for custom infix operators with custom precedence proves horribly hard too.
That's why I still love to have them, but from a language design point of view, they are not really elegant :)
 
First thing I do when using a new dialect of lisp is write an infix macro
for math only of course
I do not care about "infixing" all ops
 
I love how C++ has "ugly tricky custom infix operators" if you're ready to sell your soul away though.
 
I have not had to deal with that, so I am ignorant of the pain you describe
 
1:42 PM
if (elem <in> collection) { /* ... */ }
By overloading operator< and operator> for a hidden type whose in is an instance, you can create this kind of things and have named infix operators.
 
well you can go hog wild with dialects and dsls
 
auto result = x <in> (A <set_minus> B <set_minus> C);
Somebody recently proposed that executors (a proposed feature) overloads operators to mimic pi-calculus.
 
I can't harp on people who want to do crazy things with syntax/semantics, that is the reason why rebol and lisp attract me.
Of course I might get more opinionated about it when I actually learn c++
I tend to lack opinion on things I am ignorant of(which I believe to be a good thing, uninformed opinions are the worst)
@rgchris since you understand the usefulness of macros(performance), what is your opinion about them being added to red/rebol? More trouble than it is worth? A useful addition? Do not really care?
 
2:11 PM
@Morwenn Rebol decided to pick a few infix operators just because the programs could look a little friendlier, and didn't want to go overboard. But opening up custom infix operators for Rebol might reveal that the exact right set wasn't picked. I guess with C++ I think it's the same; who's to say one doesn't have an interesting case?
Oh, thinking of interesting cases: Tweaking Analog Literals in C++
 
The problem is: how do you define custom precedence for custom infix iterators in a flexible way?
 
The same problems arise in math some times
linear transformations use the plus sign for function application
first time I saw that I got so confused
 
And different countries use different symbols for the same operations. But the same symbols for different operations.
 
I advocate we have one "there" instead of they're their there, let people discern what it means by the context it is used in =)
next time I say there in a sentence while speaking to other people, I am going to make some kind of funny sound to differentiate it from the other theres that sound all the same
when they ask why I made that sound I will simply say my there was too vague
there was no way for them to understand it without that hooping sound
I figure most would think that to be ridiculous, quite ironic when you think about it
I decided to use there as an example since the internet's only grammatical concern is whether there was used properly
 
your/you're can also into of great concernings.
 
2:23 PM
lol
yes I was exaggerating a bit but you know what I mean
also everything you say is a straw man, analogies be damned
what you say is like this situation... STRAW MAN!
well I guess I should say straw man or woman since were all pc now
 
 
3 hours later…
5:54 PM
@MarkI So having a type difference between things you get from C literals (the char *) and the REBYTE as unsigned char turns out to have an advantage. It tells you can't just call string functions on data that might be UTF8 or otherwise encoded.
 
6:43 PM
@HostileFork Um ... hunh? C should not care whether you have any non-ASCII bytes in your strings.
 
@MarkI It doesn't care. But if you are using signed/unsigned checking, then they are incompatible types nonetheless.
This incompatibility can be leveraged if you think of what one might mean vs the other.
 
@HostileFork Riiiiight .... so you are trying to prevent, say, strlen(3), from working on REBYTE*s?
 
@MarkI ...and succeeding, yes.
C++ would do something wilder and have methods and such, and define special one-byte-sized classes you could still add and subtract. C can't do so.
But type incompatibility is at least something; and right, the one we want to avoid is strlen on REBYTE *.
Or the reverse. So then that can be at least a benefit and a clarifier for when to use one over the other in interfaces.
As it's been up until now rather random, and they've been interchangeable anyway since the warning wasn't turned on.
 
@HostileFork Well, but we do need something that can return the number of bytes, don't we? I'm thinking for realloc().
 
No realloc in Rebol. And no real reason to use it anyway.
Just a confusing function, the sort of thing that people will misunderstand.
 
6:53 PM
Let me try to summarize what you are saying:
1) strlen() is a confusing function
2) there is no real reason to use it
3) it'd be a good thing if no C strXXX() functions worked on Rebol strings
Do I have the gist right?
Is the confusion you are referring to because you think some people will expect strlen() to return the number of codepoints?
 
@MarkI No I think realloc is a confusing function, because it gives people the impression that it can keep the pointer constant...when you're basically just doing a malloc and a free. Probably does more harm than good.
But right, I don't think you should be able to use any of the strXXX() functions unless you use a little proxy macro that casts (in C) and does fancier checking in C++
That proxy macro becomes a little warning light to ask if you really know what you're doing.
That macro was called TXT( ) before, and I decided to keep the name in coherence 1.5 instead of trying to change it.
Because AS_CHARS() ... while maybe more explanatory ... was long.
But if you have bytes and want chars, just use TXT( )... and BYTES( ) goes the other way.
CTXT( ) for const chars, CBYTES( ) for const bytes. Since the macros are really just casts, and C has only one cast that does anything you want, you could call CTXT(124405) and the compiler wouldn't complain. But under the C++ build it not only complains about that... it only lets you do those limited casts. Even tells you a no-op is pointless so it considers it to be an error.
@MarkI So one little speedbump there. strlen(TXT(my_bytes)) vs. strlen(my_bytes) direct.
There aren't too many calls the way I've done things though... fairly rare. The memory functions are on void * so it doesn't apply.
 
7:19 PM
@HostileFork Oooh, cool. One question though. Is that an overloaded strlen? Does TXT convert to wide chars?
Um, two questions. :)
 
@MarkI Nope, TXT just makes chars.
It will make them out of anything you ask (in the C build) as all C casts do...
But it only makes chars out of them.
 
I see now. TXT() is a cast, right. To char *, and from unsigned char *, if I am following you correctly.
 
Narrowed to that function only in the C++ build, right...e.g. only that input type and only that output type. Which you could do with a function that cast in C. But that would make some people have a fit. Perhaps in the debug build...
 
I approve. Sorry for the confusion. I am wondering about length? on string! s, and codepoints, and graphemes.
Loads of crap. Thanks Unicode!
I saw a string function's documentation yesterday, and it blew my mind:
..... If a string contains a high surrogate codepoint that is not followed by a low surrogate codepoint, then that high surrogate must be treated as a valid character by itself .....
Unicode++, I guess.
Not only does that make it a non-conforming Unicode application, but there is no scenario in which this behaviour will not confuse EVERYONE.
I'll give you three guesses which language provides that string function.
 
@MarkI P?
 
7:31 PM
You are too funny HF. In the good way of course ...
 
I was going to make a little pixel comic at one point which had the fork and a spoon and a knife. I was living in Hollywood at the time and thought it would be funny to say they lived in Utensiltown, and it would be open source jokes.
 
I'll give some time for others to chime in before I let everyone know. Hint: you have heard of it.
 
Just beginning a little Trello for notes on the coding conventions: trello.com/b/d38MUleH/ren-c-coding-conventions
 
8:16 PM
the other channel is too slow at answering questions so here goes...
as you fellows know I am a low level nubcake
I was wondering how I would be able to "reclaim" memory from a created struct in red/system
does anyone know or is this possible?
 
@JacobGood1 Well StackOverflow is supposed to be the questions place, and the sooner people get to asking red and red-system questions the more there might be... perhaps you can frame it up as a Q&A in a way to know what you mean by reclaiming w/an example?
 
 
2 hours later…
9:56 PM
@HostileFork @JacobGood1 FYI: the Stacks feed picks up and questions and answers from StackOverflow, Code Review and Programmers. Would be an interesting feed if folks were asking questions :)
2
(like 'would adding macros to Rebol or Red be more trouble than it's worth?' on the Programmers site!!)
(a question I'm contemplating, btw)
Aside from the feed popping up in here, you can subscribe to it here: rebol.info/feeds/stacks.feed
 

« first day (1710 days earlier)      last day (2070 days later) »