« first day (1665 days earlier)      last day (2115 days later) » 
00:00 - 17:0017:00 - 23:00

12:15 AM
@rebolek I just checked JSID, and it weighs in under 15KB. I've been curious about Lest, and I'd love to see a tutorial for it <wink wink>. If you write up the lessons in text files, I'll be happy to build a tutorial for it. It really is quite simple with JSID. And then I may even feel comfortable enough with it to convert my tutorial framework to a Lest/JSID hybrid. :-)
 
12:43 AM
@HostileFork You have one in particular? Can check it out..
 
@rgchris Original Red link to Doc's "Carl is a visionary" statement... links to page without that: rebol.info/altme/10/red/6591#msg6591
 
1:14 AM
Where should I put files if I want to paste them here? pastebin or something like that?
 
1:28 AM
@Freezerburn gist.github.com is what I use, for reasons that may not be fully informed. I don't think it matters.
 
gist.github.com/anonymous/71e2e229407f04f55aae So if I'm reading the alert from this correctly, it's taking about a millisecond to do a call to the is-move function I have defined in there. Is there a particular reason it seems to be that slow? Am I measuring things wrong or something?
And if it is taking about that long, why is it taking that long and what would perform better?
 
is-move: func [input [string!] /local parts tmp] [
	parts: parse input none
	case  [
		"go" = first parts [
                    tmp: copy []
                    is-move rejoin foreach item (next parts) [append tmp append item " "]
                ]
		find [{e} {east} {w} {west} {n} {north} {s} {south}] first parts [true]
                true [false]
	]
]
@Freezerburn RebolBot isn't being too friendly, but the try rebol server comes back with a tenth of a millisecond. I just tweaked the statement to point out two things: one that CASE is useful. And secondly, that functions return their last value evaluated.
(blocks, also, evaluate to their last value in DO)
@Freezerburn If you want a code review for speedup and comments, consider codereview.stackexchange.com
@Freezerburn I'll also mention that "simple parse" has been targeted for replacement by SPLIT: curecode.org/rebol3/ticket.rsp?id=1886
>> split {abc,de,fghi,jk} {,}
 
1:46 AM
; Brought to you by: try.rebol.nl
== ["abc" "de" "fghi" "jk"]
 
>> split {abc|de/fghi:jk} charset "|/:"
 
; Brought to you by: try.rebol.nl
== ["abc" "de" "fghi" "jk"]
 
Other use cases in the ticket.
 
@HostileFork Hm, alright. Duly noted on all counts, thanks
Is there a way to get the actual milliseconds/microseconds/whatever out of a date? I'd rather see that than the full 0:00:00.001 format
 
2:03 AM
@RebolBot
t: now/time/precise
t/second
 
; Brought to you by: try.rebol.nl
== 40.915296
 
@Freezerburn If you have a time value you can use /hour /minute /second on it
 
@HostileFork Ah, that's what I've been looking for. Thank you again
 
>> pick delta-time [print "Hello"] 'second
 
; Brought to you by: try.rebol.nl
Hello
== 0.00017
 
2:08 AM
In stock win32 r3 delta-time appears to still be only to the microsecond:
|> pick delta-time [print "Hello"] 'second
Hello
== 0.0017740000000000002
Also ten times slower :(
 
@MarkI Is that you running your debug build TCC-built-with-TCC version? :-)
 
@HostileFork No, stock, I'm too much of a coward still.
 
Sounds like in addition to another disk or two, you might need a faster processor...
 
@HostileFork Who doesn't? Seriously, has anybody ever said what they have is good enough?
 
I'm pretty content with the processor I have :)
(and if something is running slow, then it's either Witcher 3 or it needs to be optimized further)
 
2:12 AM
@Freezerburn How long have you had it?
 
@MarkI At least a couple years? When was the NVidia GTX 560 Ti a mid-to-high range graphics card?
It's an i5 3.3Ghz with no hyperthreading
Works great for everything I've ever wanted to do on it
 
Quad-Core i7, RAID0 ssds, and it's actually starting to feel slow now that I'm doing all this instrumentation inside of VMs. But actually, I should look at Spotify, because it gets progressively sketcher with every so-called "upgrade"...hanging and eating CPU at random. (It has never--not once--gotten better.)
I think the use of the word "upgrade" needs some kind of regulation
The way that they started regulating the term "Light" so if you made foodproduct X then there were rules about what "X Light" had to be
Of course, this was subsequently undermined by people who didn't want to follow the rules calling it "Lite"
 
@HostileFork Maybe try adding more RAM? The only times VMs have ever been an issue causing slowdowns is when I didn't have enough RAM to support them. Also yes, most applications are basically terrible these days and are bloated piles of pain
 
@Freezerburn Well, welcome to the resistance...
 
@HostileFork Heh. I started becoming a member of that before showing up here, but glad to be a part of it. (also note: Spotify actually embeds Chrome, basically, to render certain parts of its UI. which is likely a huge chunk of why it sucks)
 
2:20 AM
@Freezerburn I think there are very few non-Rebol users who do not regularly experience a case where a few more cycles per second would help.
 
@Freezerburn Hum. Maybe I should run it as a chrome app?
 
@MarkI Only because most non-Rebol users have Mcafee or some such on their computer. Otherwise developers usually can only get incremental upgrades to things like build times by upgrading a processor. (unless you're my previous boss and you buy a 40 core machine...)
Most issues are issues caused by things like badly set up makefiles or build systems that are slow by nature (see: Scala)
(though I've heard you can compile Chrome crazy fast in parallel if you have crazy large amount of RAM)
 
@Freezerburn Incremental things add up, pun intended, but I guess I really meant "few more gigacycles per second" ...
 
@HostileFork Maybe. I don't really touch Spotify so I don't know what would be better. I prefer to have my music on an old iPod Video I found lying around recently :)
@MarkI Heh. I guess saving a couple seconds by buying the "latest and greatest" processor will eventually save you a few days of life :P
 
@Freezerburn I'd be happy with leaving work 5 minutes earlier :)
 
2:26 AM
@MarkI That's fair. Go buy a couple older model processor with 20 cores from China or something for a couple hundred bucks. That thing will crunch anything you could throw at it for a few years at least. (the cache itself is like 20 megs, which is insane!)
 
@Freezerburn I find that within limits, a little bit of slowness to a process offers time for reflection. You can multitask... let it do its thing, while you browse and think.
Being hurried and spending more time churning than thinking is what generates the worst code.
 
@HostileFork Indeed. Slow is, I find, good these days. We're being trained to want everything now now now without the time to reflect on things that we really need.
@HostileFork Also: pen and paper. The ultimate friend to all coders
 
@Freezerburn Or designers in general. This book was pretty good, I thought: amazon.com/Sketching-User-Experiences-Interactive-Technologies/…
 
@HostileFork Ooh, nice. I'll have to keep that in mind
 
@Freezerburn There's a bit of a weird tension in that Rebol was built under a somewhat haywire and organic process (compared to the rigor that most Lisps, or something like a Haskell would have used)... and I complained and complained all the way to the logo about it
But at the end, I think to understand the value does require some of that "we're building a better pencil" vs. the usual "engineering the giant universe-dominating failure-proof robot" mentality.
 
2:34 AM
@HostileFork To be fair: Most software that ends up being the things running the world are the giant balls of mud
(or just successful in general. Crash Bandicoot's code never got refactored before release. one of the 2 coders of the game insists that if they had spend any time whatsoever making the code prettier, they would not have shipped)
 
@Freezerburn Well, sometimes someone has to make the thing to criticize and improve and get people to think it's worth thinking about.
I have an easier time sometimes sorting and mapping out what other people are trying to do than coming up with some new thing to care about.
 
@HostileFork Yeah, I know the feeling. Though I think I currently have a backlog of "new things to care about" that would probably last me the rest of my life if I made it my job to work on them. (as I'm sure most programmers do)
 
@Freezerburn Well, seems you have an attitude and aesthetic you might find something of value with all this... keep asking the questions and taking stabs at it. If you flip through the tag you'll probably find something to remark on.
 
@HostileFork Will do! Honestly this feels kind of like the LISP I've always wanted to learn. A little bit easier for my brain to parse, somehow...
 
@Freezerburn Part Lisp, part Forth, part Logo, part... um... totally none of that. :-)
 
2:44 AM
@HostileFork And then Rebmu is part K :)
 
@Freezerburn If you learn the Rebol, I will teach the finer points of Rebmu... don't remember if I sent this link: codegolf.stackexchange.com/a/36114/57
But Rebmu is about to get a bit of a reboot...
 
@HostileFork Wow, impressive. On a completely separate topic, that remind me of my favorite codegolf: codegolf.stackexchange.com/a/21857
 
@Freezerburn Good one. :-)
@Freezerburn You know C and/or C++?
 
@HostileFork Both. C a bit better than C++, mostly because I find the complexity of C++ to be a bit overwhelming at times. C is just a nice simple thing where everything is a number and I can tell the computer to interpret anything however I want to interpret it
I have the C++11 Primer on my shelf though, if I need it for something
 
@Freezerburn That's actually a pretty good book, they sent me a few free copies
 
2:56 AM
(there are good parts to C++, admittedly, but it definitely has a lot of "quirks"
 
And some other junk
 
@HostileFork Yeah what I've read of it was good
 
I skipped through em for review, and gave them out. But with a "yeah, these are actually pretty good."
 
Fair enough
 
Most programming books (if you just grab a book categorized in programming at random)... are garbage.
I somehow feel this is more true than in other disciplines.
 
2:58 AM
That sounds about right. I usually try to do my research before I pick a programming book to get
Like I have the primer, Effective C++, and the 3D Math Primer written by one of the guys who works (worked?) for Valve
I'd also like to get the one written by someone who worked on Little Big Planet someday, and some of the GPU gems books
 
@Freezerburn Anyway, I got tied up in this latest wave because I was trying to make a C++ binding for Red... except then I got it wired to Rebol: youtube.com/watch?v=0exDvv5WEv4
It uses some of what we might call "trickery".
 
Wait, C++ binding? Isn't that generally classified as "insane"?
Due to mangling?
 
@Freezerburn Only a problem if you try to link C to C++. C++ can link to C.
(via extern "C")
 
So this isn't a binding that just takes any old lib and allows you to use it?
 
@Freezerburn It lets you embed Rebol or Red... like being able to embed any script engine (Python, JavaScript, etc).
(Red support on the horizon, Rebol support today...)
 
3:04 AM
@HostileFork Oh, that's what you meant by C++ binding for Rebol. The other way 'round. Herp the derp
 
It has features both ways.
If you implement functionality via raw function pointers in C, that's the same as a raw function pointer in C++
 
Indeed
 
@RebolBot
foo: function [
    {First element of "function spec dialect" (it's the description)}
    bar [string! integer!] {This bar parameter can be a string or int, eh?}
    baz {This baz parameter can be any type...}
][
    print [foo bar]
]

help foo
 
; Brought to you by: try.rebol.nl
USAGE:
    FOO bar baz

DESCRIPTION:
    First element of "function spec dialect" (it's the description)
    FOO is a function value.

ARGUMENTS:
    bar -- This bar parameter can be a string or int, eh? (string! integer!)
    baz -- This baz parameter can be any type...
 
@Freezerburn ^-- fun huh?
 
3:09 AM
seeing some new faces here today
 
@JacobGood1 Hey, you should talk to @OMGtechy... I sense a kinship. :-)
 
Nice documentation functionality. I appreciate that.
 
@HostileFork he likes lisp huh?
 
@JacobGood1 Just some similarities noted. Anyway, what's new?
 
@HostileFork hmm lots of haskell luvin in his posts, not too much kindlin to my fur
nothing really
i constantly read and lurk
 
3:13 AM
I meant more stylistically perhaps than language choices.
 
I have seen that you are beginning the predicted journey
 
@JacobGood1 Well, it's either don't or do I guess.
The definitional scoping on return had to happen, it was breaking my stuff
 
either way it gets me excited even more for this rebolion
I agree with you far too much and sound like a fan boy yes man
 
No, you just agree with the truth, as do I. :-)
 
lol
I still talk about your ide with my friends, cannot wait to play around again
 
3:16 AM
Hopefully it's about to get better
 
@HostileFork Oh yea I just got done with school
 
What's the difference between func and function?
IDE?
 
func makes vars global function does not
 
@JacobGood1 So I don't need the /local refinement for stuff I assign in the function then. Useful
 
@Freezerburn What @JacobGood1 said is the "simple answer" but the answer is actually tricky, and to understand it all really depends on knowing what definitional scoping is etc...
 
3:17 AM
of course I am a nub as well
 
The truth is, Rebol does not have scope
 
Well that's a little terrifying
 
its actually neat
 
Definitional scoping is why you can do the batty things you can do...
 
they call it definitional scoping if I remember correctly
ah yea, i got it right
 
3:18 AM
@JacobGood1 What good qualities end up coming from having everythign global? Couldn't random assignment end up causing horrible things to happen?
 
@Freezerburn If everything were global, that would imply that it had scoping. :-)
 
@HostileFork ...ow
 
Just... one scope.
 
Isn't that... the definition of a global scope?
 
there are uses, especially when you have a super malleable language
 
3:19 AM
@Freezerburn Yup. It doesn't have a global scope.
 
The first time I programmed in rebol, I was able to add destructuring in one day
that impressed the crap out of me
and this group, was amazing to have around
 
@Freezerburn So Rebol is weird because, it's dressed up funny to look like something you think is kind of obvious. You see x: 10 and then print x and go "Ah... I see! Colon is the assignment operator!" or something.
And people go "well, um... no."
 
So what is it then?
@JacobGood1 Destructuring?
As in, pulling apart tuples like fancy matching in Haskell/OCaml/Rust?
 
@Freezerburn have you ever played with common lisp, clojure, python, etc?
 
(well, tuples or structs or whatever)
 
3:22 AM
yes
pulling apart any data structure not just tuples
 
@RebolBot
code: [x: 10]
print [{The length of the code block is} length? code]
print [{The type of the first element in the code block is} type? first code]
 
; Brought to you by: try.rebol.nl
The length of the code block is 2
The type of the first element in the code block is set-word!
 
@Freezerburn So here we see that colon isn't an operator, it's something that puts a "flavor" onto a symbol. x is a word, x: is a set-word, :x is a get-word, 'x is a lit-word.
 
pattern matching is not the same as destructuring, pattern matching is more powerful(and more expensive for the most part)
 
@HostileFork Interesting. What's the use of :x as opposed to using a word directly?
(aka: what's the difference?)
@JacobGood1 Fair enough.
 
3:25 AM
@Freezerburn But one not need use these tinkertoys for variable operations if you're in non-evaluative contexts. I used set-words to implement a "dialogue" style of conversation in my blog's dialect. You can see the rendering here
 
@Freezerburn but the interesting part is that rebol allowed me, a total nub, to add it in a single day
 
@JacobGood1 Fair enough
The nice thing about Rebol that I've noticed so far is that the basics are very simple and understandable, and those few basics are the building blocks for crazy things
 
homoiconicty and parse, a nice combo
 
@Freezerburn If it's a non-evaluative context (under what we call "DO") you decide the difference of what :x or x means. My dialogue dialect is an extreme example with how I "abuse" set-word. But in an evaluative context under DO, :x suppresses evaluation.
 
I also like the syntax when I am writing it not reading it, lol... of course a nice ide could help there
 
3:28 AM
@RebolBot
old-print: :print
print: function [thing] [old-print reverse thing]
print {Revers'd!}
print: :old-print
print {Back to normalz...}
 
; Brought to you by: try.rebol.nl
!d'sreveR
Back to normalz...
 
@Freezerburn Notice that, as a necessity of the paradigm of the language...without the distinction between :print and print you couldn't suppress the lookup-and-execution of the function value to which print is tied
And of course, there's more than one way to tackle this problem... in Rebol as elsewhere. You can quote it and get it with a GET function, sure, but then you don't get this new symbol type as a toy.
 
@HostileFork lol, the examples you make, they either scare people away forever or hook them... THROW EM IN THE DEEP END
 
@HostileFork Fair enough. Interesting
@JacobGood1 The deep end is the only way to learn >:)
 
@Freezerburn And it's actually not as bad as it seems, you have choice. :-)
@RebolBot
protect 'print
old-print: :print
print: function [thing] [old-print reverse thing]
print {Revers'd!}
print: :old-print
print {Back to normalz...}
 
3:31 AM
; Brought to you by: try.rebol.nl
; rebol.com/r3/docs/errors/script-locked-word.html
    *** ERROR
** Script error: protected variable - cannot modify: print:
** Where:
** Near: try load/all join %/users/try-REBOL/data/ system/script/args...
 
You can protect all of system if you want
 
welp, I will soon have a masters in math
so thats new @HostileFork
def not in english
 
@HostileFork Good word to have in a single-scope language
 
@JacobGood1 That is new. Congrats. I thought about going back to school for math, I lived in Berkeley for a while...would have been a good place to do it
@Freezerburn I didn't say single scope. I said no scope. We still have that in our conversation queue. I just wanted to start with the word types and saying "but colon isn't the assignment operator!" to prepare you. :-)
 
@HostileFork It was very hard for me, you probably would have a fun time with it
 
3:34 AM
@JacobGood1 My EE degree honestly was mostly math, DSP specialization
 
@HostileFork Gah, right, my bad. It's 11:30pm for me so everything is super complex to me right now
I should honestly have been in bed like an hour and a half ago...
 
@Freezerburn Well this is the best time to learn. :-P In any case, let's get you at least through what definitional scoping is. It's not that hard.
 
@HostileFork Alright. Hit me with the firehose of Rebol implementation knowledge!
 
@HostileFork how long ago was that, would you be rusty now?
 
@RebolBot
a: 304

execute-twice-and-print-a: function [code [block!]] [
    a: 1020
    do code
    do code
    print a
]

execute-twice-and-print-a [print a]
 
3:37 AM
; Brought to you by: try.rebol.nl
304
304
1020
 
@Freezerburn So how would something like that work?
 
@Respectech you are working on a tutorial for rebol?
@HostileFork I had no idea machinarium was written in rebol and transpiled to flash... very, very cool
 
@HostileFork Honestly, with no scope, I'm not sure
Probably something to do with how words work?
Maybe it replaces a directly into the block before passing it as a parameter?
(so it would end up passing [print 304], since you aren't using :a which is the get-word operator, which could end up getting 1020? though do notation you said causes get-word to behave differently)
 
@Freezerburn Well, the block is passed as code. It still has a in it.
@RebolBot
a: 304

execute-twice-and-print-a: function [code [block!]] [
    probe code

    a: 1020
    do code
    do code
    print a
]

execute-twice-and-print-a [print a]
 
; Brought to you by: try.rebol.nl
[print a]
304
304
1020
 
3:42 AM
The trick comes from the fact that symbolic words... be they SET-WORD! or WORD! or GET-WORD!... have a hidden property (optional, might not be set) called its binding.
So now we have just taken the question one step further. How and when does this binding get set, and who sets it?
 
@HostileFork Something something parser block creation magic?
 
Possibly-creepy answer... it's... up to you. Additionally creepy answer: function itself is a function; what we would call a "function builder". It's a function that analyzes what its given and makes decisions about the binding in order to produce the function.
@RebolBot
ctx1: context [str: {Hi there!}]
ctx2: context [str: {Some other string...}]
code: [print str]
bind code ctx1
do code
bind code ctx2
do code
 
@HostileFork What do you mean?
 
@HostileFork Sounds kinda like the class builder in python, in a way. Which is itself a class, if I remember correctly
 
@RebolBot delete
 
3:45 AM
; Brought to you by: try.rebol.nl
Hi there!
Some other string...
 
Interesting...
 
So what FUNCTION does, compared to FUNC, is scan the body for SET-WORDS... collect them. And appropriate them as stack-locals, binding the references to the function.
You can have other weird ideas. To the extent scope exists, it's what you create.
The weird, weird thing being that this looks a heck of a lot like programming in other things... while being implemented totally differently.
 
So theoretically I can build a totally different scoping mechanism on top of rebol
 
Not just theoretically, people do it all the time.
 
Huh
I didn't know the rabbit hole of things you could do in rebol went as deep as being able to create entirely new scoping rules. That's nuts
 
3:50 AM
@Freezerburn Well, as with being able to redefine the meaning of print, there's a lot that you need to do in terms of discipline and process, and as I showed there are tools for that too...
@RebolBot
stuff: [a b c d]
protect stuff
append stuff 'e
 
; Brought to you by: try.rebol.nl
; rebol.com/r3/docs/errors/script-protected.html
    *** ERROR
** Script error: protected value or series - cannot modify
** Where: append
** Near: append stuff 'e
 
@HostileFork That goes for programming anything. At my day job doing Java I could end up with an AbstractFactoryMakerProxyFactory or some such nonsense
 
@RebolBot
stuff: [a b c d]
protect 'stuff
append stuff 'e
probe stuff
stuff: [d e f g]
 
; Brought to you by: try.rebol.nl
; rebol.com/r3/docs/errors/script-locked-word.html
    [a b c d e]
*** ERROR
** Script error: protected variable - cannot modify: stuff:
** Where:
** Near: try load/all join %/users/try-REBOL/data/ system/script/args...
 
Being able to do weird thing in Rebol doesn't mean other languages don't need discipline to not make life miserable :)
 
3:52 AM
@Freezerburn So there for instance you see a couple of degrees of control. You can protect the series data something is pointing to (protect stuff) while not protecting the word from modification. Or you can protect the word from being retargeted (protect 'stuff), while the series is treated however it was.
 
(or Qt signals... shudder quite possibly the worst thing ever, and they get abused regularly on another project at the company I work for. a 6000 line C++ Qt application which uses signals liberally between itself and other classes...)
@HostileFork Which is very nice
 
@Freezerburn Well, maybe I'm just too familiar, but once Qt signals used proper signatures in C++11 I thought they were fine. Though one gets bit every once in a while.
 
I'm assuming you can protect both the word and the contents?
 
@Freezerburn Yup
And here's a weird one
 
@HostileFork It's mostly just trying to track down the control flow of where the heck signals are going. Which might jump across four different classes to end up back in the class that emitted the original signal :/
And the standard IDE is Eclipse rather than Qt Editor, so tracking that down meant grepping
(not bad, just more annoying than "Find usages...")
 
3:55 AM
@RebolBot
login-service: object [
    password: {secret}
    check-password: function [test [string!]] [
        either password = test [print "match"] [print "no match"]
    ]
]

protect/hide 'login-service/password

probe login-service

login-service/check-password {secret}
 
; Brought to you by: try.rebol.nl
make object! [
    check-password: make function! [[test [string!]
        /local
    ][
        either password = test [print "match"] [print "no match"]
    ]]
]
match
 
@Freezerburn ^-- a totally different kind of protect... but the binding in check-password was already made...
(you don't see the password field, but it's there. New bindings can't get it unless released through an old binding)
 
Huh, cool
 
Anyway, there are some good ideas and bad ideas and what-not all in it
 
As with most things
 
3:58 AM
But I think the diligence and concern of the downloads, that's a fundamental part of the story rebolsource.net
Trying to hold it back, trying to polish it up, not wanting any sudo apt-get dependencies...
 
I applaud that effort in the current age of software... "engineering"
Makes me think of K and the kOS project, honestly. And I wonder how many other people are on the same track of rebelling against the current trends for how to make software and whatnot
 
^-- metaphor for the current state of software engineering
 
I just... what? They advertised that as a good thing?
twitch twitch
Ok, should have been in bed 2 hours ago. I'm gonna go fall onto a soft surface now and not move for a while
Night everyone
 
4:11 AM
@Freezerburn Nite, stop in again... :-)
 
 
9 hours later…
1:20 PM
@MarkI aaaaAAAaaaargh! github.com/rebol/rebol/blob/…
 
Made me smile as well. "No special decoding" bwahahaha. Easy to fix, and we will.
 
Still messing with address sanitizer
Wondered if you could run an address sanitizer program under valgrind... looks like "no": Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly. ABORTING.
 
1:50 PM
@HostileFork about padding in rebval, the four bytes are only needed for 64-bit builds, so you can't just replace it with a void*
32-bit builds need to still keep it 16-byte long and 64-bit builds need it to be 32-byte long
@HostileFork it doesn't seem to be able to run address sanitizer programs under valgrind
 
@ShixinZeng I'm not proposing changing the size, just how it's done. If the union contains a void* then the union element should be 32-bits on 32-bit platforms and 64-bits on 64-platforms. No #ifdefs needed.
so it's "padding" by making a pointer a member of the union, instead of the current method
 
No, the union is pretty tight, there is no room to add a void* on 32-bit builds
 
@ShixinZeng The union is the size of its largest element. On a 32-bit build, a pointer is 32 bits. The header would thus be... 32 bits.
(I'll point out that by "a pointer" I mean a data pointer. A function pointer can be smaller... implementation defined, could be looked up in a table. It could be a byte.)
 
Well, could you show me which struct/union you can insert this pointer?
 
    union Reb_Value_Head {
		REBHED flags;
		REBCNT header;
		void *pad; // pad header to natural size of platform
	} flags;

    union Reb_Value_Data {
        struct Reb_Word word;
        struct Reb_Series_Ref series; // !!! Rightfully Reb_Series
        REBCNT logic;
        REBI64 integer;
        ...
 
2:04 PM
that would change the size of rebval on 32-bit systems
 
@ShixinZeng I haven't tried it, but do you believe on 32-bit platforms sizeof(void*) is different from sizeof(REBCNT)... which is defined as:
typedef u32 REBCNT; // 32 bit (counting number)
 
Uh, I missed that it's an union
Let me think
 
The flags are packed, but there are more bits than that in the header. There are some particular assumptions made here about which bits of the REBCNT the REBHED chews out.
 
I think what you proposed should work
 
There is a rule that there is no offset at the head of such a structure. Hence the REBHED has to be at byte offset 0, and header has to be at byte offset 0, and the pad... it's the "no leading padding" rule
It accomplishes the same thing, just a little less #ifdef-y... simpler the better
 
2:11 PM
True
 
@ShixinZeng note also that the member structures I am embedding directly with their long awkward names, rather than taking REBWRD and such for that. Because that was never used, except in the structure... a waste if you ask me. Hence I actually make REBWRD an alias for REBVAL in the C build, which can be used to document interfaces when you know a value is a word...
And the C++ build actually uses derived classes, so you can pass a REBWRD to a routine that takes a REBVAL, but not vice versa without a cast.
So you have a nice way to document what's going on, with teeth if you build as C++ :-)
 
Are your changes published yet?
 
Soon...
 
Sounds good!
 
I'd like to crunch through every test that I have available first, make sure things are in order.
The tests now all run without crashing.
But that's not enough for me, noooo :-)
 
2:16 PM
As we are at REBVAL, what's your plan about REBALL? you want to make it the same size on 32-bit and 64-bit systems, or different size?
 
Haven't looked into what REBALL is for, actually
The thing is, in C++ (and technically, in C) you can't go around casting one class to another and reading its bits
The only thing you can do is cast to char*, and even that's usually a bad idea.
(I've probably mentioned strict aliasing here before)
So if REBALL is there as a sneaky way to try and grab out the bits, it's bad. If it's there to ensure REBVAL is the right size it's superfluous...use an assert
If it's going to be an a new type (triple-pointer!) which says "hey user, you can store three arbitrary pointer-sized things on your platform, we won't read it or write it...have fun!" ... I vote against that.
 
It's used to grab all bits in the data field
 
@ShixinZeng That's undefined behavior. stackoverflow.com/questions/98650/…
 
I first tried to make it an array of three pointers, and later I found it was used somewhere with assumption of it being three u32, so I make it six u32s
 
@ShixinZeng I'll look into it and getting rid of it
Figure out how to do whatever it is trying to do without breaking the rules
 
2:27 PM
IIRC, it's used when calculate the hash value of some REBVALs
 
@ShixinZeng Ah. Hmmm. See this is why C++ is nice. In C you wind up doing a switch statement :-/
Which is what you have to do. You can't cast structs to one another like that.
 
@HostileFork Could it be as easy as just adding a "biggest" member to the (every) union?
Not saying I know what it's for or what it does, yet, just ... proposing.
 
@MarkI You just can't do it at all. Unions are not a way of getting around the fact that casting creates undefined behavior... if you assign a union with one of its types that's the type you have to be reading out.
 
@HostileFork Er, right, of course, OK.
 
@HostileFork that undefined behavior is something new to me, do you know if/where it's specified in C standard?
 
2:32 PM
Can you "often get away with it". Well, obviously yes. You're just not programming in C
@ShixinZeng Relevant citations in this article, which is good: dbp-consulting.com/tutorials/StrictAliasing.html
 
@HostileFork Sounds to me like we can define it, then, and throw out any compiler that doesn't follow along ...
 
@HostileFork thanks
 
As long as it's not exposed to the Rebol user why should we care exactly?
 
@MarkI And then compile all the code with -O0? Wasn't it you who was just complaining about performance? :-)
 
@HostileFork How's that? How does grabbing all the bits in a union affect performance?
Or are you saying you'd have to zero out the "unset" pieces and that'd be slow, which is two statements.
 
2:37 PM
@MarkI Let's start thinking about your computer's systems as a layer of bookshelves... there's the books on your nightstand, the books on the shelf in the den, the books at the local library... the books at the library of Congress. Your computer is like you, sitting in bed, and thinking about the amount of time to get a book... >:-P
 
I can grab a "width" of books, even with one hand :)
 
The issue is that for better or worse, the analytic rules for needing to fetch things from main memory vs use a cached value in the compiler have very strong hinting from the type system.
If it can look between point A and point B and see that nothing it thinks of as type X was written to, and it sees a read from X, it won't re-fetch.
Anything you do which subverts that means you can get mysterious and sporadic problems that might happen if you don't get a fetch when you needed to.
 
Are you suggesting that a compiler misinterprets a union member write access as not invalidating all member's read accesses?
 
I'm telling you that it's quite free to do so, and likely to do so--especially in optimized builds.
 
But that's ... broken. So yes, if that's what -O0 means, that's what I'd use.
 
2:41 PM
Of course, the winds must be right for it to think it can make a meaningful optimization. You won't always get bitten...because it might think a register (or whatever) is better used for something else.
@MarkI You need to write your own language spec then. :-)
And that is not what -O0 means
Some compilers offer -fno-strict-aliasing
 
@HostileFork But what I'm saying is that any optimization based on that is an optimization I don't want, can't use, and cannot speed up what I think can be sped up.
But I am sure I am misunderstanding you.
 
@MarkI Read the above article, ask an SO question if you don't believe, see what people say <shrug>
As with a lot of things, I didn't know about it until someone told me.
 
I have read the article, twice. But I will read it again.
 
1
Q: Union: Reading from one data member of a union to write into another

Gerasimos RI know that for the code below, "Illegal" below is undefined (while some compilers allow it), because union member "a" is active, and then we read from union member "b". The question is, does the code in "AmILegal" fix it, or am I doing something scary and even more obscure? Can I use memcpy to ...

@MarkI Browsing through a tag can be a fast way of studying:
 
Come on, HF, that's an obscure question with no answers AND it's three years old. We can do better than that for this discussion.
For one thing, I'm not talking about writing to the union at all.
 
2:47 PM
@MarkI First one I found, led me to the tag. You can read them ranked by top votes, newest, oldest, etc.
 
@HostileFork Thanks, let me poke and ponder a bit ...
 
I'm not picking on that issue much yet, but in C++ it's a much bigger deal to cast one class to another...you are making a bad mistake.
It will crash and burn.
 
@HostileFork So, no unions in C++ then? :)
 
For something like a REBVAL it would obviously use inheritance
So the header would live in the base class, and then each derived class would add different data. That's the "union"
 
@HostileFork That is, what it is is not the same thing as a C union, at all.
You wouldn't even be able to talk about which of the different data elements came first or second.
 
2:52 PM
You can't really do that in unions either.
 
Right, I was overlapping into structs for a moment. As in, union of structs.
 
Well, anyway, fun to discuss all this but really yes... working with compilers and standards and such has some practical concerns to it. Yet it's good to know what the rules are before you break them, and justify the breakage and be sure there's not a better way.
 
If you will forgive me for speaking theoretically, I can understand the reasoning behind the no-strict-aliasing choices.
There is nothing preventing an implementation from choosing to disallow a certain bit pattern from appearing in the bitset backing store of an integer, and unifying a structure of bytes on top of that may allow such a pattern to be created, causing mayhem.
But I also fear that there are few, if any, implementations OR compilers that actually are written that way.
 
For many things the way the standard goes is "acts as if"
 
And whether or not we need to concern ourselves is the actual question, for which we need actual examples.
 
2:59 PM
The thing is that the weirder what you try to do gets, the more important it is to follow the rules if you want stuff to work. If you want to emscripten compile, then you've got a "weird" program that's actually running on JavaScript as a "processor"...and sometimes these cases are exploiting the language of the standard to provide an effective experience.
 
I think even the floating point standard allows multiple NaN representations so that there's no "bad form" possible, if you choose it so.
 
It might encode a boolean false as some weird native type; the rule isn't that the bit pattern of a boolean false be zero. The rule is that when a boolean false is converted to an integer, you get zero
 
@HostileFork Right, the emulation nightmare. Too scary, I hide now :) bbl
 
Well that's the experience of C and C++, and a motive for using it. I think if you want to program in assembly that's different. These are abstracted tools for certain applications; and while it's popular to say that C is a kind of "cross-platform-assembly" the way it was standardized was on purpose...
Turning up the optimizations lead to not insignificant improvements.
 
But that's two wildly different and mutually exclusive objectives, optimized compiling and clean emulation.
GOT TO GO I will return soon.
 
3:04 PM
TTYL
 
 
1 hour later…
4:19 PM
Jeez, setjmp/longjmp are nightmares.
Score one for address sanitizer... caught an insidious problem!
 
@HostileFork Logged, with detailed explanation, I trust, so I can say, good work!
But back to emulation/optimization.
Here are my two, not necessarily independent, issues with this:
1) A perfectly good emulator can be built that treats unions exactly the same way it treats structs.
2) Aren't we insulated since what will be emulated will be the C compiler so the resultant objects files will be packed the way we want anyway.
 
You'd have to explain what your motivations are and frame the argument more so I knew what you were aiming to address, and by that time you'd probably have a good StackOverflow question, at which point there are likely people who would jump in with more knowledge than I on this topic
 
TCC is what will need to run in the emulator, not the Rebol C sources. Does that help any?
And I am trying to frame the argument. Just not successfully yet :)
So what platform the actual Rebol C sources were being compiled to run on would be held inside the TCC instance running on the emulator.
And staring at my last message confuses even me, so, that's way worse than failure ... I'll try to clean it up and rephrase later.
 
4:49 PM
Although if struct {int x;} is not compatible with struct {int x;} stackoverflow.com/questions/28521188/… the task does not look easy ...
If that's what C++ brings to the table, you can keep it.
Just because language lawyers have twisted the words of the standard to suit whatever agenda they have does not mean implementations that take advantage of said twists should be respected, encouraged, or allowed for in any way whatsoever. IMO!
 
00:00 - 17:0017:00 - 23:00

« first day (1665 days earlier)      last day (2115 days later) »