Jump to content
Registration disabled at the moment Read more... ×

pmcgee

Members
  • Content Count

    73
  • Joined

  • Last visited

  • Days Won

    2

pmcgee last won the day on April 14

pmcgee had the most liked content!

Community Reputation

27 Excellent

1 Follower

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Looks like it was here : https://stackoverflow.com/questions/5344433/how-can-i-declare-a-pointer-based-on-a-generic-type
  2. I feel like I seen this somewhere .. maybe even from Marco Cantu .. mentioning that this "hack" was necessary. PMyType<T> = record P: ^TMyType<T>; end;
  3. @Keesver how do you create a QuickJS_32.dll ?
  4. @Stefan Glienke do you distinguish between the terms 'anonymous method' and 'anonymous function'? I have mostly heard the word 'method' being used for something like "procedure of object / function of object".
  5. const and const[ref] work differently in this case (for example) : procedure Proc(const nValue: Integer); var pValue: ^Integer; begin writeln(integer(@nvalue)); pValue := @nValue; pValue^:= nValue*2; end; begin var x:=1; writeln(x, ' ', integer(@x)); proc(x); writeln(x); readln; end. 'Const' case prints '1 1', and const[ref] prints '1 2'
  6. Good point. I had overlooked that case. I see what you are saying ... but I haven't worked out what I think as a result. I was looking at the disassembly side by side for four cases ... until a Windows forced a restart on me. Ah ... actually I was using Google Sheets instead of Excel : https://docs.google.com/spreadsheets/d/1ZGJ6seGZR_zNO_mpke6733fHGgOVhoM6PH_q1x7tJB8/edit?usp=sharing (I hadn't finished tracing through all the steps.)
  7. Well, firstly I think if it's not type-safe, then it's surely just not correct. But maybe even more than that, it would be to deny having functions as "first class citizens". If there's evolution ahead in the language, it surely must include being able to pass functions around per-se.
  8. Ok, I get it. I had the bushy end of the pineapple. 🙂 So, we want it to complain in BOTH cases. Yes?
  9. Wait. We DO want a compiler error here, right?? X takes an integer, not a TFunc<Integer>. It makes sense that this should need to be X( f() ).
  10. Just following links from this nice link ... Barry Kelly in 2010 : http://blog.barrkel.com/2010/01/using-anonymous-methods-in-method.html
  11. One thing I noticed about Const[ref] relates to 'reference shadowing' (maybe there's a better term). If you call a function/procedure that takes a const string, the function uses a new reference to the string. With const[ref] it uses the exact existing reference. {$APPTYPE CONSOLE} program Project1; uses system.SysUtils, System.Generics.Collections; type pr = TPair<integer,integer>; procedure call_i1 ( const x:integer); begin writeln( integer(@x) ); end; procedure call_i2 (const[ref] x:integer); begin writeln( integer(@x) ); end; procedure call_c1 ( const x:TObject); begin writeln( integer(@x) ); end; procedure call_c2 (const[ref] x:TObject); begin writeln( integer(@x) ); end; procedure call_s1 ( const x:string); begin writeln( integer(@x) ); end; procedure call_s2 (const[ref] x:string); begin writeln( integer(@x) ); end; procedure call_p1 ( const x:pr); begin writeln( integer(@x) ); end; procedure call_p2 (const[ref] x:pr); begin writeln( integer(@x) ); end; begin var i : integer; var o : TObject; var p : pr; var s : string; writeln( integer(@i) ); call_i2(i); call_i1(i); writeln; writeln( integer(@o) ); call_c2(o); call_c1(o); writeln; writeln( integer(@s) ); call_s2(s); call_s1(s); writeln; writeln( integer(@p) ); call_p2(p); call_p1(p); readln; end. For TPair, the const[ref] makes no difference ... but for string, integer, and Class, it uses the address of the original value or reference.
  12. There is a section of the programming community, from eg Alexander Stepanov, to eg Jason Turner (of C++Weekly) That consider implicit conversion to be evil, or a safety issue. (https://news.ycombinator.com/item?id=24806884) (Google shows me links about it from 2005, 2010, 2015, and 2020 🙂 ) I guess their argument is for explicit casts (if absolutely necessary), over what might be termed 'a wing and a prayer'. Certainly this works : S := 'Testing: ' + string(V);
  13. The original Github repo (https://github.com/rvelthuis/DelphiBigNumbers) has a pdf by Rudy explaining the library. And it says this :
  14. PS : I have submitted an update to the TurboPack repo on Github, with the appropriate attribution back to this thread. https://github.com/TurboPack/RudysBigNumbers/pull/10
  15. Yes. Right. Got it. I did go to the link, but my brain saw the (az+b)(cz+d) and totally failed to see that this was exactly the z = 1.e32 (in binary) that I was using. And thank you for the information about the Elliptic Curve stuff (El-Gamal) to read up on. I'll be very interested to read it.
×