You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a recapitulative of the task of supporting multiple package.
Rationale
The rationale for this issue is to overcome a limitation of gong, namely, only the "models" package is compiled by gongc. Any subpackage is ignored. Therefore, more complex models cannot be compiled. For models like 15288 modelling or SySML, multiple packages are needed for complexity management (and for name collision avoidance).
Scope
It is understood that multipackage model won't need
compilation for the front.
Map_DocLink_Renaming
To be abandonned (unless it is easy after all the rest has been done)
XL marshalling/unsmarshalling
Remaining are:
stage
serialization
reverse maps of slice of pointers
ast marshalling / unmarshalling
persistance (back repo)
controllers
probe
Architecture
The manual example developed in test2 shows that the generated code could be very similar from one package to the other (except for the package modelsthat becomes package x or package ormthat becomes package x and the imports that need to be aliased contollers_x, orm_x, ...
Have gong models evolves to store package hierarchy
Have gongdoc proposes a tree with all identifiers in the package hierarchy
Develop a useful multipackage models to get a sense of what is needed
De Weck Architecture Tool, with a concrete syntax would be ideal. But a model with a package "user" and another "product" seems more helpfull for a start
Package hierarchy for orm
Package hierarchy for controllers
Package hierarchy for probe
Package hierachy for FullStackInstance
modifs goes the same depencecy way
controllers
orm
models
Front:
components generation
sidebar (to be done after the tree)
front repo
Supporting hierarchy is key for complexity mngt. (for mimicking jointjs hierarchy for instance)
going from one stack is one package to one stack is many packages
There is per stack:
one back repo
one controller
one DB
one stage (makes sense)
For marshalling, there is a need to convert the package path into a unique identifier
github.com/fullstack-lang/gong/test/go/models
what package alias can be automaticaly devised ?
Here's the updated implementation that uses the last three parts of the import path to generate unique aliases:
package main
import (
"fmt""strings"
)
funcgenerateAliases(importPaths []string) map[string]string {
aliases:=make(map[string]string)
counter:=make(map[string]int)
for_, path:=rangeimportPaths {
parts:=strings.Split(path, "/")
// Generate an initial alias using the last three parts of the import path.varaliasstringiflen(parts) >=3 {
alias=fmt.Sprintf("%s_%s_%s", parts[len(parts)-3], parts[len(parts)-2], parts[len(parts)-1])
} elseiflen(parts) ==2 {
alias=fmt.Sprintf("%s_%s", parts[len(parts)-2], parts[len(parts)-1])
} else {
alias=parts[len(parts)-1]
}
// If the alias has already been used, append a number to make it unique.for {
count, exists:=counter[alias]
ifexists {
counter[alias]++alias=fmt.Sprintf("%s%d", alias, count)
} else {
counter[alias] =1break
}
}
aliases[path] =alias
}
returnaliases
}
funcmain() {
importPaths:= []string{
"github.com/fullstack-lang/gong/test/go/models",
"github.com/anotheruser/anotherproject/test/go/models",
"github.com/thirduser/thirdproject/test/go/models",
}
aliases:=generateAliases(importPaths)
forpath, alias:=rangealiases {
fmt.Printf("%s => %s\n", path, alias)
}
}
$ time go run toto.go
github.com/thirduser/thirdproject/test/go/models => test_go_models2
github.com/fullstack-lang/gong/test/go/models => test_go_models
github.com/anotheruser/anotherproject/test/go/models => test_go_models1
For go:
identify the element per stack from the element per package.
hierarchy in controllers follows hierarchy in models
hierachy in orm follows hierarchy in models
typeBackRepoRootstruct {
// insertion point for per struct back repo declarationsBackRepoAstructBackRepoAstructStructBackRepoAstructBstruct2UseBackRepoAstructBstruct2UseStructBackRepoAstructBstructUseBackRepoAstructBstructUseStructBackRepoBstructBackRepoBstructStructBackRepoDstructBackRepoDstructStruct
}
typeBackRepostruct {
BackRepoRootCommitFromBackNbuint// records commit increments when performed by the backPushFromFrontNbuint// records commit increments when performed by the frontstage*models.StageStruct
}
For ng:
hierarchy in lib/ componenet follows hierarchy in models
For the commit on a stage to be performed on all stages that are dependant of the stage, one need to apply the Depth First Search algorithm.
funcDFS(node*Node, visitedmap[*Node]bool, fnfunc(*Node)) {
ifnode==nil||visited[node] {
return
}
visited[node] =true// Apply the given function to the current nodefn(node)
// Visit neighborsfor_, neighbor:=rangenode.Neighbors {
DFS(neighbor, visited, fn)
}
}
This is a recapitulative of the task of supporting multiple package.
Rationale
The rationale for this issue is to overcome a limitation of gong, namely, only the "models" package is compiled by gongc. Any subpackage is ignored. Therefore, more complex models cannot be compiled. For models like 15288 modelling or SySML, multiple packages are needed for complexity management (and for name collision avoidance).
Scope
It is understood that multipackage model won't need
To be abandonned (unless it is easy after all the rest has been done)
Remaining are:
Architecture
The manual example developed in
test2
shows that the generated code could be very similar from one package to the other (except for thepackage models
that becomespackage x
orpackage orm
that becomespackage x
and the imports that need to be aliasedcontollers_x, orm_x, ...
Steps
De Weck Architecture Tool, with a concrete syntax would be ideal. But a model with a package "user" and another "product" seems more helpfull for a start
modifs goes the same depencecy way
Front:
Supporting hierarchy is key for complexity mngt. (for mimicking jointjs hierarchy for instance)
going from one stack is one package to one stack is many packages
There is per stack:
For marshalling, there is a need to convert the package path into a unique identifier
what package alias can be automaticaly devised ?
Here's the updated implementation that uses the last three parts of the import path to generate unique aliases:
For go:
For ng:
still on front repo
The text was updated successfully, but these errors were encountered: