Skip to content

Instantly share code, notes, and snippets.

@Yatekii
Created July 6, 2020 09:02
Show Gist options
  • Save Yatekii/8d4bf16f20176524785570e2552b3da5 to your computer and use it in GitHub Desktop.
Save Yatekii/8d4bf16f20176524785570e2552b3da5 to your computer and use it in GitHub Desktop.
[16:38:41] <IceMichael> Yatekii: wie siehst du das eigentlich damit, dass RefCell quasi wie ein unique_ptr in C++ ist? hast vorhin gar nicht geantwortet :D
[17:08:08] <IceMichael> tja und auch jetzt kommt nix, na dann
[18:34:58] <bashquest> is nix wo kommit nix
[19:43:04] *** Mode #sppro +o Nimelrian by ChanServ
[20:49:36] <Yatekii> IceMichael: wow du hast vieleicht ne geduld ...
[20:50:21] <Yatekii> 1. bin ich nicht gut in C++ 2. sagt das quasi schon alles 3. hast du mich zumindest das letzte mal nicht highlighted. ich kann nich alles überall lesen ...
[20:51:23] <Yatekii> hmm xq nächste frage ofc ... weisst du wie ich in nem selber zusammengesetzten expression tree auf ne variable in nem namespace, z.B. Math.PI zugreifen kann? mit funktionen ist das lustigerweise iwie easy. mit variablen scheint mir das nciht so :/
[20:51:41] <Yatekii> ohwow, doch ich wurde von xq gehighlighted
[20:51:46] <Yatekii> mea culpa, will read
[20:52:00] <Yatekii> kp hab' das hochlicht nicht gekriegt/gesehen :/ sorry
[20:53:34] <Yatekii> Box == unique_ptr
[20:54:10] <Yatekii> RefCell hat kein aequivalent weil es in C++ sowas wie borrowing oder unique access nicht enforced gibt :)
[20:56:20] <Yatekii> RefCell braucht man für interior mutability. also d.h. wenn der owner von nem value readonly ist aber trotzdem was schreiben muss. und nein, das ist kein widerspruch, kann aber nur zur laufzeit sicher geprüft werden. darum brauchts die RefCell :) ich benutz das z.B. für inner caches oder wenn man eben nen refcount will wo man den inhalt auch mutieren kann, dann braucht man RefCell :)
[20:56:47] <Yatekii> denn Rc (refcount) koordiniert nur wer gerade zugriff hat, aber nicht wer schreiben darf :)
[20:56:49] <xq> ah
[20:56:59] <xq> naja, RefCell ist ja trtzdem ne referenz, korrekt?
[20:57:08] <Yatekii> RefCell/Rc sind aber NICHT threadsafe
[20:57:31] <xq> ah
[20:57:51] <Yatekii> xq: ja RefCell is n owned value der intern ne Box (weiss nicht ob wirklich oder nur sinnbildlich) hat, welche n pointer auf den heap ist :)
[20:57:55] <Yatekii> aber halt n owned pointer ;)
[20:58:04] <xq> jo, dann hab ich das doch richtig verstanden :)
[20:58:41] <Yatekii> is aber nich zu verwechseln mit nem Mutex :) also Mutex is das threadsafe pendant zu ner RefCell :)
[20:58:57] <Yatekii> Rc<RefCell<T>> wird oft bei potenziell zyklischen graphen verwendet
[21:04:32] <Yatekii> Error parsing system config file: System.InvalidOperationException: variable 'System.Math.PI' of type 'System.Double' referenced from scope '', but it is not defined
[21:04:38] <Yatekii> arghhh das muss doch gehen :/
[21:05:14] <xq> örm
[21:05:26] <xq> schick mal die line in question
[21:10:14] <Yatekii> naja, ich hab' halt keine ahnung wie ich das angehe. ich glaub ich muss ne funktion konstruieren und da alles reinreichen, was ich iwie komisch finde. aber ich glaub das is weil das lambda das ich da konstruiere halt sonst das nich captured
[21:10:20] <Yatekii> return Expression.Variable(typeof(double), "System.Math." + name); // das habe ich bisher versucht
[21:10:30] <Yatekii> aber das ist halt nur um ne variable zu bauen afauk
[21:15:46] <xq> das ist baer keine variable, sondern PI ist afaik ne property
[21:16:25] <Yatekii> ah das würd sinn machen
[21:16:34] <Yatekii> obwohls in reflection GetField() heisst xD
[21:16:46] <Yatekii> consistency is key :D
[21:18:28] <Yatekii> ich glaub' du hast recht
[21:18:36] <Yatekii> mit property scheint das zu gehen
[21:18:56] <Yatekii> aber ich hab' grad rausgefunden dass mein custom parser absolut für nix ist -.- c# kann das ja eh alles out of the box -.-
[21:19:01] -*- Yatekii is so schlau
[21:22:26] <Yatekii> oder auch nicht. SO hat mich wohl angelogen. was ganz neues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment