Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
X# vs VFP
Message
From
18/10/2019 05:32:58
 
 
To
18/10/2019 03:54:47
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Title:
Miscellaneous
Thread ID:
01671547
Message ID:
01671551
Views:
152
Likes (1)
Hi Daniel,

> Thanks for this great clarification on Xsharp vs VFP and all the stuff you provided lately.
You are more than welcome, and also thanks a lot for your participation!

> I imagine that could be:
> - use something like an "in memory sqlite engine" (a typical solution for C-based python),
> - some linq-related technology...
Well I think this is maybe the two aspects I will address in this response...

Linq is already supported in both Linq and Lambda format:
LOCAL  dPot AS System.Func<Prop, List<Prop> >
dPot := ;
		{ p AS Prop =>
			VAR Potentials := List<Prop>{}
			VAR pcs := 0
			Potentials:Add(p)
			LOCAL oP AS Prop
			REPEAT
				oP := Prop{p:Name, p:Quantity, p:Price}{Pieces := ++pcs}
				Potentials:Add(oP)
			UNTIL Prop.Qualify(oP:Constraint())
			RETURN Potentials
		}
VAR oPot1 := dPot(oP1)
VAR oPot2 := dPot(oP2)
VAR oPot3 := dPot(oP3)

VAR oSol := (FROM p1 IN oPot1 ;
				JOIN p2 IN oPot2 ON TRUE EQUALS TRUE ;
				JOIN p3 IN oPot3 ON TRUE EQUALS TRUE ;
			WHERE Prop.Qualify(p1:Constraint() + p2:Constraint() + p3:Constraint()) ;
			ORDERBY (p1:Minimize() + p2:Minimize() + p3:Minimize()) ;
			SELECT <INT>{p1:Pieces, p2:Pieces, p3:Pieces}):Take(3)
Regarding in memory "SQLite", I am busy looking at converting the following ArrayServer class from Visual Objects to X#. The DevTeam has indicated after SWFOX the VFP Cursor will get priority, this might be the basis of it realising...:
CLASS ArrayServer INHERIT DataServer
   /* The following IVars inherit from DataServer:
      aClients    // Array with all Notify-Clients
      aDataFields // Array with DataField object for each column
      nCCMode     // Concurrency mode
      nLastLock   // ???
      oHLStatus   // HyperLabel identifying the status after the last operation
      oHyperLabel // HyperLabel of the Server
      wFieldCount // Number of columns
   */
   PROTECT _aData       AS ARRAY // Two dimensional Array with the data
   PROTECT _wRecNo      AS WORD  // Current row
   PROTECT _wLastRec    AS WORD  // Number of rows
   PROTECT _aDeleted    AS ARRAY // Deleted flags for _aData
   PROTECT _lEoF        AS LOGIC // EoF flag
   PROTECT _lBoF        AS LOGIC // BoF flag
   PROTECT _aRecord     AS ARRAY // Buffer for the current record
   PROTECT _lSetDeleted AS LOGIC // SetDeleted() state for this server
   PROTECT _aNewRec     AS ARRAY // Default values for new records

   // We emulate the DbServer class, so add these also to the class
   PROTECT aStruct               AS ARRAY
   PROTECT siSuspendNotification AS SHORT

   /* I think the following Messages are automatically handled by DataServer,
      because we use the inherited PROTECT intance variables, particularly
      aDataFields.

      PROPERTIES
      ConcurrencyControl Access/Assign
      FCount Access
      HyperLabel Access/Assign
      Name Access
      NameSym Access

      METHODS
      AsString
      DataField
      Commit
      FieldHyperLabel
      FieldName
      FieldPos
      FieldSpec
      FieldStatus
      FieldValidate
      NoIvarGet
      NoIvarPut
      RegisterClient
      UnregisterClient
   */
      METHOD Append() CLASS ArrayServer
      ACCESS DBStruct CLASS ArrayServer
      METHOD Close() CLASS ArrayServer
      METHOD Commit() CLASS ArrayServer
      ACCESS Data() CLASS ArrayServer
      METHOD DefaultValue( uFieldID ) CLASS ArrayServer
      ACCESS BoF CLASS ArrayServer
      METHOD Delete() CLASS ArrayServer
      ACCESS Deleted CLASS ArrayServer
      ACCESS EoF CLASS ArrayServer
      METHOD FIELDGET( uFieldID ) CLASS ArrayServer
      METHOD FieldGetFormatted( uFieldID ) CLASS ArrayServer
      ACCESS LASTREC() CLASS ArrayServer
      METHOD Notify( kNotifyName, uDescription ) CLASS ArrayServer
      METHOD Recall() CLASS ArrayServer
      METHOD RecallAll() CLASS ArrayServer
      ACCESS RecCount CLASS ArrayServer
      ACCESS RecNo CLASS ArrayServer
      ASSIGN RECNO( nNewRec ) CLASS ArrayServer
      METHOD Refresh() CLASS ArrayServer
      METHOD ResetNotification() CLASS ArrayServer
      ASSIGN SetDeleted( lDeleted ) CLASS ArrayServer
      METHOD Skip( nSkip ) CLASS ArrayServer
      METHOD SuspendNotification() CLASS ArrayServer
      DEFINE MAX_ARRAY := 65535
      METHOD FieldPos( uFieldID ) CLASS ArrayServer
      METHOD FIELDPUT( uFieldID, uValue ) CLASS ArrayServer
      METHOD GoBottom() CLASS ArrayServer
      METHOD GoTo( nNewRec ) CLASS ArrayServer
      METHOD GoTop() CLASS ArrayServer
      METHOD Init( aArrayStruct, aDataArray ) CLASS ArrayServer
END CLASS
> Hope my post was clear enough. Language design is not my thing!
Loud and clear
Johan Nel
George, South Africa
Friend of XSharp (FOX) member
E-mail : johan(dot)nel(at)xsinet(dot)co(dot)za
Web site : https://xsharp.info
X# runtime : https://github.com/X-Sharp/XSharpPublic
Radio talk : https://blog.aksel.com/2019/07/why-xsharp-might-be-tool-foxpro.html
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform